UNPKG

motion

Version:

motion - moving development forward

72 lines (71 loc) 3.67 kB
{ "_args": [ [ "reduce-css-calc@https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-1.2.0.tgz", "/Users/nw/flint/packages/flint" ] ], "_from": "reduce-css-calc@>=1.2.0 <2.0.0", "_id": "reduce-css-calc@1.2.0", "_inCache": true, "_location": "/reduce-css-calc", "_phantomChildren": {}, "_requested": { "name": "reduce-css-calc", "raw": "reduce-css-calc@https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-1.2.0.tgz", "rawSpec": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-1.2.0.tgz", "scope": null, "spec": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-1.2.0.tgz", "type": "remote" }, "_requiredBy": [ "/postcss-calc" ], "_resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-1.2.0.tgz", "_shasum": "e191e362e93da4c0f0f992dea12932a2e10db191", "_shrinkwrap": null, "_spec": "reduce-css-calc@https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-1.2.0.tgz", "_where": "/Users/nw/flint/packages/flint", "author": { "name": "Maxime Thirouin" }, "bugs": { "url": "https://github.com/MoOx/reduce-css-calc/issues" }, "dependencies": { "balanced-match": "^0.1.0", "reduce-function-call": "^1.0.1" }, "description": "Reduce CSS calc() function to the maximum", "devDependencies": { "jscs": "^1.5.9", "jshint": "^2.5.2", "tape": "^2.13.4" }, "files": [ "CHANGELOG.md", "LICENSE", "index.js" ], "homepage": "https://github.com/MoOx/reduce-css-calc#readme", "keywords": [ "calc", "calculation", "css" ], "license": "MIT", "name": "reduce-css-calc", "optionalDependencies": {}, "readme": "# reduce-css-calc [![Build Status](https://travis-ci.org/MoOx/reduce-css-calc.png)](https://travis-ci.org/MoOx/reduce-css-calc)\n\n> Reduce CSS calc() function to the maximum.\n\nParticularly useful for packages like [rework-calc](https://github.com/reworkcss/rework-calc) or [postcss-calc](https://github.com/postcss/postcss-calc).\n\n## Installation\n\n```console\n$ npm install reduce-css-calc\n```\n\n## Usage\n\n### `var reducedString = reduceCSSCalc(string, precision)`\n\n```javascript\nvar reduceCSSCalc = require('reduce-css-calc')\n\nreduceCSSCalc(\"calc(1 + 1)\")\n// 2\n\nreduceCSSCalc(\"calc((6 / 2) - (4 * 2) + 1)\")\n// -4\n\nreduceCSSCalc(\"calc(1/3)\")\n// 0.33333\n\nreduceCSSCalc(\"calc(1/3)\", 10)\n// 0.3333333333\n\nreduceCSSCalc(\"calc(3rem * 2 - 1rem)\")\n// 5rem\n\nreduceCSSCalc(\"calc(2 * 50%)\")\n// 100%\n\nreduceCSSCalc(\"calc(120% * 50%)\")\n// 60%\n\nreduceCSSCalc(\"a calc(1 + 1) b calc(1 - 1) c\")\n// a 2 b 0 c\n\nreduceCSSCalc(\"calc(calc(calc(1rem * 0.75) * 1.5) - 1rem)\")\n// 0.125rem\n\nreduceCSSCalc(\"calc(calc(calc(1rem * 0.75) * 1.5) - 1px)\")\n// calc(1.125rem - 1px)\n\nreduceCSSCalc(\"-moz-calc(100px / 2)\")\n// 50px\n\nreduceCSSCalc(\"-moz-calc(50% - 2em)\")\n// -moz-calc(50% - 2em)\n```\n\nSee [unit tests](test/index.js) for others examples.\n\n## Contributing\n\nWork on a branch, install dev-dependencies, respect coding style & run tests before submitting a bug fix or a feature.\n\n```console\n$ git clone https://github.com/MoOx/reduce-css-calc.git\n$ git checkout -b patch-1\n$ npm install\n$ npm test\n```\n\n## [Changelog](CHANGELOG.md)\n\n## [License](LICENSE-MIT)\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/MoOx/reduce-css-calc.git" }, "scripts": { "jscs": "jscs *.js **/*.js", "jshint": "jshint . --exclude node_modules", "test": "npm run jscs && npm run jshint && tape test" }, "version": "1.2.0" }