{"name":"style-to-js","version":"1.1.0","keywords":["style-to-js","css","style","javascript","object","pojo"],"author":{"name":"Mark","email":"mark@remarkablemark.org"},"license":"MIT","_id":"style-to-js@1.1.0","maintainers":[{"name":"remarkablemark","email":"mark@remarkablemark.org"}],"homepage":"https://github.com/remarkablemark/style-to-js#readme","bugs":{"url":"https://github.com/remarkablemark/style-to-js/issues"},"dist":{"shasum":"631cbb20fce204019b3aa1fcb5b69d951ceac4ac","tarball":"http://registry-npm.ywwl.com/style-to-js/download/style-to-js-1.1.0.tgz","fileCount":12,"integrity":"sha512-1OqefPDxGrlMwcbfpsTVRyzwdhr4W0uxYQzeA2F1CBc8WG04udg2+ybRnvh3XYL4TdHQrCahLtax2jc8xaE6rA==","signatures":[{"sig":"MEUCIQCASazg8lAZKnMWFCWf2ExSggXQIVFTFeCQbAsAzf+V0wIgNeFfYuPvEFTIMIzpf5zHUcR4cDqmiMpEokpNVDuw3VI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":49965,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfuuaWCRA9TVsSAnZWagAAnNoP/iJMwD6wiQlOHpi7oKfe\nG3rg4GtW5rBYyi0O1P21VlebGmSb+rWodRYBZCMOnr3TcjY/yheshNr8Mxq5\nHDnLSlsYjZ5mMSlAluiFJrs4y8/x6I2gqA0lMmEI1/Tm2hhoiVcbKIKfyG7a\nMHgDrwXIyv6VmZuz64/nFasveTccBqm3tTIe9fhBADSuknzAB7/IIwzZnGfQ\n/ohn/btm//tttWoK1xJ8vPQ5metATIXqI2T7NbYRJbe3FUxuPeNOkc1Nl+VE\nBQOkiuMvDBoguO/QKbzgKfOA1anc9yjhUiROuET/bWRAlK5nAZO+G0CCyCVJ\n4wE5e/QKfyKA3ExQvlDmvjNs4bCdf9bjmckijxxiCPVzUMGHzjG1HdTN4DR3\nS7+bEEJkhwiY//4rXC+c92oBE55eH8HKItTD+6m8qoP9ShIz0KQa5w9Pmqmm\nKhCXDuHuqP7cjLGBlmzYTmZaNC3qxcjE3Gb5+5fSec4qFIoEjpYvxs61bC8l\nX2xt6qPamNYVPxCNLG9APzhvsDp29/Q21QPEq6LEpjfkuLaC6MHfujA92rwl\nHY0HAzBZijSHO6yeeNtllVJz7S4N6QpLis3bH7g3jS7yc5Fm1/IwBJpy381I\n2o2hiBnjAVv5pCzGrL/cWs/cykJ+3IbhYD6aNsWqTihEyD4+HItr5xjsuc+I\nRV0B\r\n=Pv3v\r\n-----END PGP SIGNATURE-----\r\n","size":12624,"noattachment":false,"key":"/style-to-js/-/style-to-js-1.1.0.tgz"},"main":"cjs/index.js","gitHead":"c1e98ed77cc61a2acc5f49455b1f99edf875d0b1","scripts":{"lint":"npm run lint:js && npm run lint:ts && npm run lint:tsc","test":"jest --coverage","build":"npm run build:cjs && npm run build:umd","clean":"rm -rf cjs umd","lint:js":"eslint --ignore-path .gitignore .","lint:ts":"npm run lint:js -- --ext .ts","release":"standard-version --no-verify","lint:fix":"npm run lint:js -- --fix && npm run lint:ts -- --fix","lint:tsc":"tsc --noEmit","build:cjs":"tsc --declaration --outDir cjs","build:umd":"rollup --config","test:watch":"jest --watch","prepublishOnly":"npm run lint && npm test && npm run clean && npm run build"},"_npmUser":{"name":"remarkablemark","email":"mark@remarkablemark.org"},"repository":{"url":"git+https://github.com/remarkablemark/style-to-js.git","type":"git"},"_npmVersion":"7.0.8","description":"Parses CSS inline style to JavaScript object (camelCased).","directories":{},"_nodeVersion":"15.1.0","dependencies":{"style-to-object":"0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^26.6.3","husky":"^4.3.0","eslint":"^7.14.0","rollup":"^2.33.3","ts-jest":"^26.4.4","prettier":"^2.2.0","typescript":"^4.1.2","@types/jest":"^26.0.15","lint-staged":"^10.5.1","@commitlint/cli":"^11.0.0","standard-version":"^9.0.0","rollup-plugin-terser":"^7.0.2","eslint-plugin-prettier":"^3.1.4","@rollup/plugin-commonjs":"^16.0.0","@rollup/plugin-typescript":"^6.1.0","@typescript-eslint/parser":"^4.8.1","@rollup/plugin-node-resolve":"^10.0.0","@commitlint/config-conventional":"^11.0.0","@typescript-eslint/eslint-plugin":"^4.8.1"},"_npmOperationalInternal":{"tmp":"tmp/style-to-js_1.1.0_1606084245680_0.7893347245201012","host":"s3://npm-registry-packages"},"readme":"# style-to-js\n\n[![NPM](https://nodei.co/npm/style-to-js.png)](https://nodei.co/npm/style-to-js/)\n\n[![NPM version](https://img.shields.io/npm/v/style-to-js)](https://www.npmjs.com/package/style-to-js)\n[![BNPM bundle size](https://img.shields.io/bundlephobia/minzip/style-to-js)](https://bundlephobia.com/package/style-to-js)\n[![build](https://github.com/remarkablemark/style-to-js/actions/workflows/build.yml/badge.svg)](https://github.com/remarkablemark/style-to-js/actions/workflows/build.yml)\n[![codecov](https://codecov.io/gh/remarkablemark/style-to-js/branch/master/graph/badge.svg?token=JWKUKTFT3E)](https://codecov.io/gh/remarkablemark/style-to-js)\n[![NPM downloads](https://img.shields.io/npm/dm/style-to-js)](https://www.npmjs.com/package/style-to-js)\n\nParses CSS inline style to JavaScript object (camelCased):\n\n```\nStyleToJS(string)\n```\n\n## Example\n\n```js\nimport parse from 'style-to-js';\n\nparse('background-color: #BADA55;');\n```\n\nOutput:\n\n```json\n{ \"backgroundColor\": \"#BADA55\" }\n```\n\n[JSFiddle](https://jsfiddle.net/remarkablemark/04nob1y7/) | [Examples](https://github.com/remarkablemark/style-to-js/tree/master/examples)\n\n## Install\n\n[NPM](https://www.npmjs.com/package/style-to-js):\n\n```sh\nnpm install style-to-js --save\n```\n\n[Yarn](https://yarnpkg.com/package/style-to-js):\n\n```sh\nyarn add style-to-js\n```\n\n[CDN](https://unpkg.com/style-to-js/):\n\n```html\n<script src=\"https://unpkg.com/style-to-js@latest/umd/style-to-js.min.js\"></script>\n<script>\n  window.StyleToJS(/* string */);\n</script>\n```\n\n## Usage\n\n### Import\n\nImport with ES Modules:\n\n```js\nimport parse from 'style-to-js';\n```\n\nRequire with CommonJS:\n\n```js\nconst parse = require('style-to-js');\n```\n\n### Parse style\n\nParse single declaration:\n\n```js\nparse('line-height: 42');\n```\n\nOutput:\n\n```json\n{ \"lineHeight\": \"42\" }\n```\n\n> [!NOTE]\n> Notice that the CSS property is camelCased.\n\nParse multiple declarations:\n\n```js\nparse(`\n  border-color: #ACE;\n  z-index: 1337;\n`);\n```\n\nOutput:\n\n```json\n{\n  \"borderColor\": \"#ACE\",\n  \"zIndex\": \"1337\"\n}\n```\n\n### Vendor prefix\n\nParse [vendor prefix](https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix):\n\n```js\nparse(`\n  -webkit-transition: all 4s ease;\n  -moz-transition: all 4s ease;\n  -ms-transition: all 4s ease;\n  -o-transition: all 4s ease;\n  -khtml-transition: all 4s ease;\n`);\n```\n\nOutput:\n\n```json\n{\n  \"webkitTransition\": \"all 4s ease\",\n  \"mozTransition\": \"all 4s ease\",\n  \"msTransition\": \"all 4s ease\",\n  \"oTransition\": \"all 4s ease\",\n  \"khtmlTransition\": \"all 4s ease\"\n}\n```\n\n### Custom property\n\nParse [custom property](https://developer.mozilla.org/en-US/docs/Web/CSS/--*):\n\n```js\nparse('--custom-property: #f00');\n```\n\nOutput:\n\n```json\n{ \"--custom-property\": \"#f00\" }\n```\n\n### Unknown declaration\n\nThis library does not validate declarations, so unknown declarations can be parsed:\n\n```js\nparse('the-answer: 42;');\n```\n\nOutput:\n\n```json\n{ \"theAnswer\": \"42\" }\n```\n\n### Invalid declaration\n\nDeclarations with missing value are removed:\n\n```js\nparse(`\n  margin-top: ;\n  margin-right: 1em;\n`);\n```\n\nOutput:\n\n```json\n{ \"marginRight\": \"1em\" }\n```\n\nOther invalid declarations or arguments:\n\n```js\nparse(); // {}\nparse(null); // {}\nparse(1); // {}\nparse(true); // {}\nparse('top:'); // {}\nparse(':12px'); // {}\nparse(':'); // {}\nparse(';'); // {}\n```\n\nThe following values will throw an error:\n\n```js\nparse('top'); // Uncaught Error: property missing ':'\nparse('/*'); // Uncaught Error: End of comment missing\n```\n\n### Options\n\n#### reactCompat\n\nWhen option `reactCompat` is true, the [vendor prefix](https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix) will be capitalized:\n\n```js\nparse(\n  `\n    -webkit-transition: all 4s ease;\n    -moz-transition: all 4s ease;\n    -ms-transition: all 4s ease;\n    -o-transition: all 4s ease;\n    -khtml-transition: all 4s ease;\n  `,\n  { reactCompat: true },\n);\n```\n\nOutput:\n\n```json\n{\n  \"WebkitTransition\": \"all 4s ease\",\n  \"MozTransition\": \"all 4s ease\",\n  \"msTransition\": \"all 4s ease\",\n  \"OTransition\": \"all 4s ease\",\n  \"KhtmlTransition\": \"all 4s ease\"\n}\n```\n\nThis removes the React warning:\n\n```\nWarning: Unsupported vendor-prefixed style property %s. Did you mean %s?%s\", \"oTransition\", \"OTransition\"\n```\n\n## Testing\n\nRun tests with coverage:\n\n```sh\nnpm test\n```\n\nRun tests in watch mode:\n\n```sh\nnpm run test:watch\n```\n\nLint files:\n\n```sh\nnpm run lint\n```\n\nFix lint errors:\n\n```sh\nnpm run lint:fix\n```\n\n## Release\n\nRelease and publish are automated by [Release Please](https://github.com/googleapis/release-please).\n\n## Special Thanks\n\n- [style-to-object](https://github.com/remarkablemark/style-to-object)\n\n## License\n\n[MIT](https://github.com/remarkablemark/style-to-js/blob/master/LICENSE)\n","publish_time":1606084245835,"_cnpm_publish_time":1606084245835,"dist-tags":{"latest":"2.0.2"}}