{"_id":"startijenn-rem","_rev":"259828","name":"startijenn-rem","description":"JavaScript function to convert CSS rem units.","dist-tags":{"latest":"1.1.1"},"maintainers":[{"name":"pierreburel","email":"contact@pierreburel.com"}],"time":{"modified":"2023-03-27T17:09:48.000Z","created":"2021-04-10T14:30:39.865Z","1.1.1":"2023-03-27T00:19:14.020Z","1.1.0":"2022-08-10T14:41:33.770Z","1.0.2":"2021-07-08T22:31:42.525Z","1.0.1":"2021-04-28T12:05:44.699Z","1.0.0":"2021-04-10T14:30:39.865Z"},"users":{},"author":{"name":"Pierre Burel","email":"contact@pierreburel.com"},"repository":{"type":"git","url":"git+https://github.com/pierreburel/startijenn-rem.git"},"versions":{"1.1.1":{"name":"startijenn-rem","version":"1.1.1","description":"JavaScript function to convert CSS rem units.","keywords":["javascript","css","rem","responsive","typography"],"main":"index.cjs.js","module":"index.js","types":"index.d.ts","scripts":{"prepublish":"npm run build","build":"rollup -c","pretest":"npm run build","test":"jest"},"author":{"name":"Pierre Burel","email":"contact@pierreburel.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/pierreburel/startijenn-rem.git"},"bugs":{"url":"https://github.com/pierreburel/startijenn-rem/issues"},"homepage":"https://github.com/pierreburel/startijenn-rem","devDependencies":{"jest":"^29.5.0","rollup":"^3.20.2"},"gitHead":"bd12b17ad9fc68ce7efd6463d222071cea2d8c0e","_id":"startijenn-rem@1.1.1","_nodeVersion":"16.18.1","_npmVersion":"8.19.2","dist":{"shasum":"6b237cf931fe1294d2d9bcad09d90c3612198a4c","size":3102,"noattachment":false,"key":"/startijenn-rem/-/startijenn-rem-1.1.1.tgz","tarball":"http://name.csiicloud.com:7001/startijenn-rem/download/startijenn-rem-1.1.1.tgz"},"_npmUser":{"name":"pierreburel","email":"contact@pierreburel.com"},"directories":{},"maintainers":[{"name":"pierreburel","email":"contact@pierreburel.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/startijenn-rem_1.1.1_1679876353856_0.9539060627335036"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-03-27T00:19:14.020Z","publish_time":1679876354020,"_cnpm_publish_time":1679876354020},"1.1.0":{"name":"startijenn-rem","version":"1.1.0","description":"JavaScript function to convert CSS rem units.","keywords":["javascript","css","rem","responsive","typography"],"main":"index.cjs.js","module":"index.js","types":"index.d.ts","scripts":{"prepublish":"npm run build","build":"rollup -c","pretest":"npm run build","test":"jest"},"author":{"name":"Pierre Burel","email":"contact@pierreburel.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/pierreburel/startijenn-rem.git"},"bugs":{"url":"https://github.com/pierreburel/startijenn-rem/issues"},"homepage":"https://github.com/pierreburel/startijenn-rem","devDependencies":{"jest":"^28.1.0","rollup":"^2.75.5"},"gitHead":"59b893583b3a4dc0fd9739ee23c43c12457fc9f9","_id":"startijenn-rem@1.1.0","_nodeVersion":"16.2.0","_npmVersion":"7.15.0","dist":{"shasum":"08aa3423bb9ac60c4fd19b01ffa20bfcf40391f2","size":3032,"noattachment":false,"key":"/startijenn-rem/-/startijenn-rem-1.1.0.tgz","tarball":"http://name.csiicloud.com:7001/startijenn-rem/download/startijenn-rem-1.1.0.tgz"},"_npmUser":{"name":"pierreburel","email":"contact@pierreburel.com"},"directories":{},"maintainers":[{"name":"pierreburel","email":"contact@pierreburel.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/startijenn-rem_1.1.0_1660142493563_0.5876630938721781"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-08-10T14:42:13.218Z","publish_time":1660142493770,"_cnpm_publish_time":1660142493770},"1.0.2":{"name":"startijenn-rem","version":"1.0.2","description":"JavaScript function to convert CSS rem units.","keywords":["javascript","css","rem","responsive","typography"],"main":"./index.cjs.js","module":"./index.js","scripts":{"prepublish":"npm run build","build":"rollup -c","pretest":"npm run build","test":"jest"},"author":{"name":"Pierre Burel","email":"contact@pierreburel.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/pierreburel/startijenn-rem.git"},"bugs":{"url":"https://github.com/pierreburel/startijenn-rem/issues"},"homepage":"https://github.com/pierreburel/startijenn-rem","devDependencies":{"jest":"^27.0.6","rollup":"^2.52.8"},"gitHead":"295b98db693d62bc1d149f1eafc7926a8f9dc9db","_id":"startijenn-rem@1.0.2","_nodeVersion":"16.2.0","_npmVersion":"7.15.0","dist":{"shasum":"6b967214554bd3cf98c8a535e64f8cf870e26d80","size":2627,"noattachment":false,"key":"/startijenn-rem/-/startijenn-rem-1.0.2.tgz","tarball":"http://name.csiicloud.com:7001/startijenn-rem/download/startijenn-rem-1.0.2.tgz"},"_npmUser":{"name":"pierreburel","email":"contact@pierreburel.com"},"directories":{},"maintainers":[{"name":"pierreburel","email":"contact@pierreburel.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/startijenn-rem_1.0.2_1625783502361_0.5858384490379991"},"_hasShrinkwrap":false,"publish_time":1625783502525,"_cnpm_publish_time":1625783502525,"_cnpmcore_publish_time":"2021-12-17T00:58:32.355Z"},"1.0.1":{"name":"startijenn-rem","version":"1.0.1","description":"JavaScript function to convert CSS rem units.","keywords":["javascript","css","rem","responsive","typography"],"main":"./index.cjs.js","module":"./index.js","scripts":{"prepublish":"npm run build","build":"rollup -c","pretest":"npm run build","test":"jest"},"author":{"name":"Pierre Burel","email":"contact@pierreburel.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/pierreburel/startijenn-rem.git"},"bugs":{"url":"https://github.com/pierreburel/startijenn-rem/issues"},"homepage":"https://github.com/pierreburel/startijenn-rem","devDependencies":{"jest":"^26.6.3","rollup":"^2.45.1"},"gitHead":"afa5277eb0b42e40d33ce4afd08d0b744e07e76e","_id":"startijenn-rem@1.0.1","_nodeVersion":"15.3.0","_npmVersion":"7.0.14","dist":{"shasum":"3f62f868fd7cc1b9353410b3868d67329840469a","size":2648,"noattachment":false,"key":"/startijenn-rem/-/startijenn-rem-1.0.1.tgz","tarball":"http://name.csiicloud.com:7001/startijenn-rem/download/startijenn-rem-1.0.1.tgz"},"_npmUser":{"name":"pierreburel","email":"contact@pierreburel.com"},"directories":{},"maintainers":[{"name":"pierreburel","email":"contact@pierreburel.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/startijenn-rem_1.0.1_1619611544539_0.7431207241859377"},"_hasShrinkwrap":false,"publish_time":1619611544699,"_cnpm_publish_time":1619611544699,"_cnpmcore_publish_time":"2021-12-17T00:58:32.654Z"},"1.0.0":{"name":"startijenn-rem","version":"1.0.0","description":"JavaScript function to convert CSS rem units.","keywords":["javascript","css","rem","responsive","typography"],"type":"module","main":"./index.cjs.js","module":"./index.js","scripts":{"prepublish":"npm run build","build":"rollup -c","pretest":"npm run build","test":"jest"},"author":{"name":"Pierre Burel","email":"contact@pierreburel.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/pierreburel/startijenn-rem.git"},"bugs":{"url":"https://github.com/pierreburel/startijenn-rem/issues"},"homepage":"https://github.com/pierreburel/startijenn-rem","devDependencies":{"jest":"^26.6.3","rollup":"^2.45.1"},"gitHead":"aa387d94510b66b0c6168e885bf1762035a78c64","_id":"startijenn-rem@1.0.0","_nodeVersion":"15.3.0","_npmVersion":"7.0.14","dist":{"shasum":"eabd0f47be32c054a214fdbbb674de5c06bf779f","size":2656,"noattachment":false,"key":"/startijenn-rem/-/startijenn-rem-1.0.0.tgz","tarball":"http://name.csiicloud.com:7001/startijenn-rem/download/startijenn-rem-1.0.0.tgz"},"_npmUser":{"name":"pierreburel","email":"contact@pierreburel.com"},"directories":{},"maintainers":[{"name":"pierreburel","email":"contact@pierreburel.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/startijenn-rem_1.0.0_1618065039678_0.2628396704485596"},"_hasShrinkwrap":false,"publish_time":1618065039865,"_cnpm_publish_time":1618065039865,"_cnpmcore_publish_time":"2021-12-17T00:58:32.840Z"}},"readme":"# startijenn-rem [![Node.js CI](https://github.com/pierreburel/startijenn-rem/actions/workflows/node.js.yml/badge.svg)](https://github.com/pierreburel/startijenn-rem/actions/workflows/node.js.yml)\n\nJavaScript function to convert CSS rem units. Used by [postcss-rem](https://github.com/pierreburel/postcss-rem).\n\n## Usage\n\nInstall with `npm i startijenn-rem`.\n\n```js\nimport rem, { em, px, convert } from \"startijenn-rem\";\n\nconst unitless = rem(24);\n// '1.5rem'\n\nconst simple = rem(\"24px\");\n// '1.5rem'\n\nconst multipleValues = rem(\"5px -10px 1.5rem\");\n// '0.3125rem -0.625rem 1.5rem'\n\nconst multipleMixedValues = rem(\"1px solid black\");\n// '0.0625rem solid black'\n\nconst commaSeparatedValues = rem(\"0 0 2px #ccc, inset 0 0 5px #eee\");\n// '0 0 0.125rem #ccc, inset 0 0 0.3125rem #eee'\n\nconst variable = \"5px\";\nconst withVariable = rem(`${variable} 10px`);\n// '0.3125rem 0.625rem'\n\nconst array = rem([24, \"24px\", \"5px -10px 1.5rem\"]);\n// ['1.5rem', '1.5rem', '0.3125rem -0.625rem 1.5rem']\n\nconst object = rem({\n  fontSize: 24,\n  margin: \"24px\",\n  padding: \"5px -10px 1.5rem\",\n});\n// {fontSize: '1.5rem', margin: '1.5rem', padding: '0.3125rem -0.625rem 1.5rem'}\n\nconst changingBaseline = rem(\"24px\", { baseline: 10 });\n// '2.4rem'\n\nconst changingPrecision = rem(\"16px\", { baseline: 12, precision: 3 });\n// '1.333rem'\n\nconst convertToPx = px(\"1.5rem 24px\");\n// '24px 24px'\n\nconst convertFunction = convert(\"24px\", \"em\", { baseline: 12 });\n// '2em' (can only convert to rem, em or px)\n\nconst StyledComponent = styled.h1`\n  font-size: ${(fontSize) => rem(fontSize)};\n  padding: ${(fontSize) => em(12, fontSize)};\n  margin: ${rem(\"8px 16px\")};\n`;\n// .StyledComponent { font-size: 1.5rem; padding: 0.5em; margin: 0.5rem 1rem; }\n\nconst h1 = (text) => <StyledComponent fontSize={24}>{text}</StyledComponent>;\n```\n\nYou can change the default options of the functions by doing your own aliases.\n\n```js\nimport { convert } from \"startijenn-rem\";\n\nexport const rem = (value) => convert(value, \"rem\", { baseline: 10 });\n\nexport const em = (value, baseline = 10) => convert(value, \"em\", { baseline });\n\nexport default rem;\n```\n\n```js\nimport rem, { em } from \"./utils/rem\";\n\nconst unitless = rem(24);\n// '2.4rem'\n\nconst convertToEm = em(\"12px\", \"24px\");\n// '0.5em'\n\nconst object = rem({\n  fontSize: 24,\n  margin: \"24px\",\n  padding: \"5px -10px 1.5rem\",\n});\n// {fontSize: 2.4, margin: '2.4rem', padding: '0.5rem -1rem 1.5rem'}\n\nconst StyledComponent = styled.h1`\n  font-size: ${(fontSize) => rem(fontSize)};\n  padding: ${(fontSize) => em(\"6px 12px\", fontSize)};\n`;\n// .StyledComponent { font-size: 2.4rem; padding: 0.25em 0.5em; }\n\nconst h1 = (text) => <StyledComponent fontSize={24}>{text}</StyledComponent>;\n```\n","_attachments":{},"homepage":"https://github.com/pierreburel/startijenn-rem","bugs":{"url":"https://github.com/pierreburel/startijenn-rem/issues"},"license":"MIT"}