{"name":"style-to-js","version":"1.1.1","keywords":["style-to-js","css","style","javascript","object","pojo"],"author":{"name":"Mark","email":"mark@remarkablemark.org"},"license":"MIT","_id":"style-to-js@1.1.1","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":"417786986cda61d4525c80aed9d1123a6a7af9b8","tarball":"http://registry-npm.ywwl.com/style-to-js/download/style-to-js-1.1.1.tgz","fileCount":11,"integrity":"sha512-RJ18Z9t2B02sYhZtfWKQq5uplVctgvjTfLWT7+Eb1zjUjIrWzX5SdlkwLGQozrqarTmEzJJ/YmdNJCUNI47elg==","signatures":[{"sig":"MEYCIQCLtZPJQKVXiIRiMKbSxwB9q4lQ3LKiEd5rZmLUx3JHzwIhAM3EubHx+031kMNTdpLSdxi4aiIdAluRhi3u7PCQVF65","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":49970,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJilSesACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmprcw/7BfIxpKihgBmxOT9khFQXgBFo3Ux8dUqeGz4hzPM7EkkcQ1pd\r\nMXK+Tl0zwnTjFNdw7yQ03j1xhWDPF9tRcGAPuqm+oWJpbAjvvtA0vyHJYKvs\r\nd/o0KmjTW7Ez/lCwzuk6K+owaibMiL6Fp2/vPv8tDHu0e8IdudYRZ5JC5JWV\r\nQH+rI4IIV3v2KOwIqmrNp8id25gPWhYlYM4ApzF8+kWUEyVJIRJRNds4rjQx\r\nIw9vR5rUXqu/YGK3EgxUCw24K/cFvpjQnbiD03UOGj+ebNXPnsVgdUHVDXCB\r\n+A+XJcDcUMkwdmp9o2tZzeKfTHPkGj6RbdakpcOWAKc2DM715qxvFqd8CbX3\r\nGSCjyHApuwKf+UITm6KDfB63Ypu320g44U2WHpNpUUyyeMapxsalP1z534gm\r\nrWQ3RPEztkvXTIh8+FUrcJEPgDV7ZOr2xNHHH7bi8hlPPgwBc/K6qK32rjPz\r\nCEH40kRZ/kauYLJFuAyZylNb5FfQAP5uofVUgSmftGOihgcX1tH4dxawJRPV\r\nvelAkIpBeheWhFy5bZhrO0J25es701+LCROISBs/GSJVSlgCUt1SvD7yEFhg\r\nh16tsKIQcbaaCQ5RHKKQ5A2l21+ggJWfAy02rXS1cGX9z5MW7v/5ThtMPb+F\r\nmWfJPPiz0FG3iXnXzVvCQHXyp/UIN0ZsGaw=\r\n=KeYD\r\n-----END PGP SIGNATURE-----\r\n","size":12290,"noattachment":false,"key":"/style-to-js/-/style-to-js-1.1.1.tgz"},"main":"cjs/index.js","types":"./cjs/index.d.ts","gitHead":"3eb8bdd4abd857fb8ca9603fd0e75b5e5ac5f605","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","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","postpublish":"pinst --enable","_postinstall":"husky install","prepublishOnly":"pinst --disable && 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":"8.5.5","description":"Parses CSS inline style to JavaScript object (camelCased).","directories":{},"_nodeVersion":"16.15.0","dependencies":{"style-to-object":"0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.0","husky":"^8.0.1","pinst":"^3.0.0","eslint":"^8.16.0","rollup":"^2.75.3","ts-jest":"^28.0.3","prettier":"^2.6.2","typescript":"^4.7.2","@types/jest":"^27.5.1","lint-staged":"^12.4.3","@commitlint/cli":"^17.0.1","rollup-plugin-terser":"^7.0.2","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^22.0.0","@rollup/plugin-typescript":"^8.3.2","@typescript-eslint/parser":"^5.27.0","@rollup/plugin-node-resolve":"^13.3.0","@commitlint/config-conventional":"^17.0.0","@typescript-eslint/eslint-plugin":"^5.27.0"},"_npmOperationalInternal":{"tmp":"tmp/style-to-js_1.1.1_1653942188414_0.11481416231217834","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":1653942188585,"_cnpm_publish_time":1653942188585,"dist-tags":{"latest":"2.0.2"}}