style-to-object
Advanced tools
Comparing version 0.2.3 to 0.3.0
@@ -5,2 +5,21 @@ # Changelog | ||
## [0.3.0](https://github.com/remarkablemark/style-to-object/compare/v0.2.3...v0.3.0) (2019-11-07) | ||
### Bug Fixes | ||
* **index:** update return type of main function (remove `any`) ([c6e8a54](https://github.com/remarkablemark/style-to-object/commit/c6e8a54)) | ||
### Features | ||
* add typescript support ([74a1b83](https://github.com/remarkablemark/style-to-object/commit/74a1b83)) | ||
### Tests | ||
* **index:** add test for TS declaration file ([b029a4b](https://github.com/remarkablemark/style-to-object/commit/b029a4b)) | ||
### [0.2.3](https://github.com/remarkablemark/style-to-object/compare/v0.2.2...v0.2.3) (2019-06-22) | ||
@@ -7,0 +26,0 @@ |
@@ -5,3 +5,3 @@ (function (global, factory) { | ||
(global = global || self, global.StyleToObject = factory()); | ||
}(this, function () { 'use strict'; | ||
}(this, (function () { 'use strict'; | ||
@@ -309,2 +309,2 @@ // http://www.w3.org/TR/CSS21/grammar.html | ||
})); | ||
}))); |
@@ -1,2 +0,2 @@ | ||
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(n=n||self).StyleToObject=r()}(this,function(){"use strict";var m=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,g=/\n/g,y=/^\s*/,d=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,w=/^:\s*/,A=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,x=/^[;\s]*/,r=/^\s+|\s+$/g,b="";function E(n){return n?n.replace(r,b):b}return function(n,r){var t,e=null;if(!n||"string"!=typeof n)return e;for(var o,i,u=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var o=1,i=1;function u(n){var r=n.match(g);r&&(o+=r.length);var t=n.lastIndexOf("\n");i=~t?n.length-t:i+n.length}function c(){var r={line:o,column:i};return function(n){return n.position=new f(r),l(),n}}function f(n){this.start=n,this.end={line:o,column:i},this.source=t.source}function a(n){var r=new Error(t.source+":"+o+":"+i+": "+n);if(r.reason=n,r.filename=t.source,r.line=o,r.column=i,r.source=e,!t.silent)throw r}function s(n){var r=n.exec(e);if(r){var t=r[0];return u(t),e=e.slice(t.length),r}}function l(){s(y)}function p(n){var r;for(n=n||[];r=h();)!1!==r&&n.push(r);return n}function h(){var n=c();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var r=2;b!=e.charAt(r)&&("*"!=e.charAt(r)||"/"!=e.charAt(r+1));)++r;if(r+=2,b===e.charAt(r-1))return a("End of comment missing");var t=e.slice(2,r-2);return i+=2,u(t),e=e.slice(r),i+=2,n({type:"comment",comment:t})}}function v(){var n=c(),r=s(d);if(r){if(h(),!s(w))return a("property missing ':'");var t=s(A),e=n({type:"declaration",property:E(r[0].replace(m,b)),value:t?E(t[0].replace(m,b)):b});return s(x),e}}return f.prototype.content=e,l(),function(){var n,r=[];for(p(r);n=v();)!1!==n&&(r.push(n),p(r));return r}()}(n),c="function"==typeof r,f=0,a=u.length;f<a;f++)o=(t=u[f]).property,i=t.value,c?r(o,i,t):i&&((e=e||{})[o]=i);return e}}); | ||
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(n=n||self).StyleToObject=r()}(this,function(){"use strict";function s(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var o=1,i=1;function u(n){var r=n.match(g);r&&(o+=r.length);var t=n.lastIndexOf("\n");i=~t?n.length-t:i+n.length}function c(){var r={line:o,column:i};return function(n){return n.position=new f(r),l(),n}}function f(n){this.start=n,this.end={line:o,column:i},this.source=t.source}function a(n){var r=new Error(t.source+":"+o+":"+i+": "+n);if(r.reason=n,r.filename=t.source,r.line=o,r.column=i,r.source=e,!t.silent)throw r}function s(n){var r=n.exec(e);if(r){var t=r[0];return u(t),e=e.slice(t.length),r}}function l(){s(n)}function p(n){var r;for(n=n||[];r=h();)!1!==r&&n.push(r);return n}function h(){var n=c();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var r=2;x!=e.charAt(r)&&("*"!=e.charAt(r)||"/"!=e.charAt(r+1));)++r;if(r+=2,x===e.charAt(r-1))return a("End of comment missing");var t=e.slice(2,r-2);return i+=2,u(t),e=e.slice(r),i+=2,n({type:"comment",comment:t})}}function v(){var n=c(),r=s(y);if(r){if(h(),!s(d))return a("property missing ':'");var t=s(w),e=n({type:"declaration",property:b(r[0].replace(m,x)),value:t?b(t[0].replace(m,x)):x});return s(A),e}}return f.prototype.content=e,l(),function(){var n,r=[];for(p(r);n=v();)!1!==n&&(r.push(n),p(r));return r}()}var m=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,g=/\n/g,n=/^\s*/,y=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,d=/^:\s*/,w=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,A=/^[;\s]*/,r=/^\s+|\s+$/g,x="";function b(n){return n?n.replace(r,x):x}return function(n,r){var t,e=null;if(!n||"string"!=typeof n)return e;for(var o,i,u=s(n),c="function"==typeof r,f=0,a=u.length;f<a;f++)o=(t=u[f]).property,i=t.value,c?r(o,i,t):i&&((e=e||{})[o]=i);return e}}); | ||
//# sourceMappingURL=style-to-object.min.js.map |
{ | ||
"name": "style-to-object", | ||
"version": "0.2.3", | ||
"version": "0.3.0", | ||
"description": "Converts inline style to object.", | ||
"author": "Mark <mark@remarkablemark.org>", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"scripts": { | ||
"build": "npm run clean && npm run build:min && npm run build:unmin", | ||
"build": "run-s build:*", | ||
"build:min": "NODE_ENV=production rollup --config --file dist/style-to-object.min.js --sourcemap", | ||
@@ -15,3 +16,4 @@ "build:unmin": "NODE_ENV=development rollup --config --file dist/style-to-object.js", | ||
"lint:fix": "npm run lint -- --fix", | ||
"prepublishOnly": "npm run build", | ||
"lint:dts": "dtslint .", | ||
"prepublishOnly": "run-s lint lint:dts test clean build", | ||
"release": "standard-version --no-verify", | ||
@@ -43,22 +45,25 @@ "test": "mocha", | ||
"devDependencies": { | ||
"@commitlint/cli": "^8.0.0", | ||
"@commitlint/config-conventional": "^8.0.0", | ||
"coveralls": "^3.0.4", | ||
"eslint": "^6.0.0", | ||
"eslint-plugin-prettier": "^3.1.0", | ||
"husky": "^2.4.1", | ||
"lint-staged": "^8.2.1", | ||
"mocha": "^6.1.4", | ||
"@commitlint/cli": "^8.2.0", | ||
"@commitlint/config-conventional": "^8.2.0", | ||
"coveralls": "^3.0.7", | ||
"dtslint": "^1.0.3", | ||
"eslint": "^6.6.0", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"husky": "^3.0.9", | ||
"lint-staged": "^9.4.2", | ||
"mocha": "^6.2.2", | ||
"npm-run-all": "^4.1.5", | ||
"nyc": "^14.1.1", | ||
"prettier": "^1.18.2", | ||
"rollup": "^1.16.2", | ||
"rollup-plugin-commonjs": "^10.0.0", | ||
"rollup-plugin-node-resolve": "^5.0.4", | ||
"rollup-plugin-uglify": "^6.0.2", | ||
"standard-version": "^6.0.1" | ||
"rollup": "^1.26.3", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-uglify": "^6.0.3", | ||
"standard-version": "^6" | ||
}, | ||
"files": [ | ||
"/dist" | ||
"/dist", | ||
"index.d.ts" | ||
], | ||
"license": "MIT" | ||
} |
@@ -14,4 +14,4 @@ # style-to-object | ||
```js | ||
var parser = require('style-to-object'); | ||
parser('color: #C0FFEE; background: #BADA55;'); | ||
var parse = require('style-to-object'); | ||
parse('color: #C0FFEE; background: #BADA55;'); | ||
``` | ||
@@ -133,3 +133,3 @@ | ||
```js | ||
parser('color: #f00', function(name, value, declaration) { | ||
parse('color: #f00', function(name, value, declaration) { | ||
console.log(name); // 'color' | ||
@@ -149,5 +149,7 @@ console.log(value); // '#f00' | ||
const output = []; | ||
function iterator(name, value) { | ||
output.push([name, value]); | ||
} | ||
parse(style, iterator); | ||
@@ -175,3 +177,5 @@ console.log(output); // [['color', 'red'], ['background', 'blue']] | ||
$ npm run test:coverage | ||
# npm run test:coverage:report | ||
# generate html report | ||
$ npm run test:coverage:report | ||
``` | ||
@@ -191,2 +195,8 @@ | ||
Test TypeScript declaration file for style and correctness: | ||
```sh | ||
$ npm run lint:dts | ||
``` | ||
## Release | ||
@@ -193,0 +203,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
30488
9
342
214
0
17