style-to-object 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.d.ts +32 -25
  2. package/package.json +7 -7
package/index.d.ts CHANGED
@@ -2,37 +2,44 @@
2
2
  * Parses inline style to object.
3
3
  *
4
4
  * @example
5
- * import StyleToObject from 'style-to-object';
6
- * StyleToObject('line-height: 42;');
5
+ *
6
+ * ```ts
7
+ * import parse from 'style-to-object';
8
+ * parse('line-height: 42;'); // { 'line-height': '42' }
9
+ * ```
7
10
  */
8
- declare function StyleToObject(
11
+ export default function StyleToObject(
9
12
  style: string,
10
- iterator?: StyleToObject.Iterator
13
+ iterator?: Iterator
11
14
  ): { [name: string]: string } | null;
12
15
 
13
- export = StyleToObject;
14
-
15
- declare namespace StyleToObject {
16
- interface DeclarationPos {
16
+ interface Position {
17
+ start: {
18
+ line: number;
19
+ column: number;
20
+ };
21
+ end: {
17
22
  line: number;
18
23
  column: number;
19
- }
24
+ };
25
+ source?: string;
26
+ }
20
27
 
21
- // declaration is an object from module `inline-style-parser`
22
- interface Declaration {
23
- type: string;
24
- property: string;
25
- value: string;
26
- position: {
27
- start: DeclarationPos;
28
- end: DeclarationPos;
29
- source: any;
30
- };
31
- }
28
+ export interface Declaration {
29
+ type: 'declaration';
30
+ property: string;
31
+ value: string;
32
+ position: Position;
33
+ }
32
34
 
33
- type Iterator = (
34
- property: string,
35
- value: string,
36
- declaration: Declaration
37
- ) => void;
35
+ export interface Comment {
36
+ type: 'comment';
37
+ comment: string;
38
+ position: Position;
38
39
  }
40
+
41
+ type Iterator = (
42
+ property: string,
43
+ value: string,
44
+ declaration: Declaration | Comment
45
+ ) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "style-to-object",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Converts inline style to object.",
5
5
  "author": "Mark <mark@remarkablemark.org>",
6
6
  "main": "index.js",
@@ -20,9 +20,9 @@
20
20
  "_postinstall": "husky install",
21
21
  "postpublish": "pinst --enable",
22
22
  "prepublishOnly": "pinst --disable && run-s lint lint:dts test clean build",
23
- "test": "mocha --exclude **/*.mjs",
24
- "test:coverage": "nyc npm test",
25
- "test:module": "node --experimental-modules test/index.mjs",
23
+ "test": "jest",
24
+ "test:ci": "CI=true jest --ci --colors --coverage",
25
+ "test:esm": "node --test __tests__/index.test.mjs",
26
26
  "test:watch": "npm run test -- --watch"
27
27
  },
28
28
  "repository": {
@@ -47,17 +47,17 @@
47
47
  "devDependencies": {
48
48
  "@commitlint/cli": "17.8.0",
49
49
  "@commitlint/config-conventional": "17.8.0",
50
+ "@definitelytyped/dtslint": "0.0.182",
50
51
  "@rollup/plugin-commonjs": "25.0.5",
51
52
  "@rollup/plugin-node-resolve": "15.2.3",
52
53
  "@rollup/plugin-terser": "0.4.4",
53
- "dtslint": "4.2.1",
54
+ "@typescript-eslint/parser": "5.62.0",
54
55
  "eslint": "8.51.0",
55
56
  "eslint-plugin-prettier": "5.0.1",
56
57
  "husky": "8.0.3",
58
+ "jest": "29.7.0",
57
59
  "lint-staged": "14.0.1",
58
- "mocha": "10.2.0",
59
60
  "npm-run-all": "4.1.5",
60
- "nyc": "15.1.0",
61
61
  "pinst": "3.0.0",
62
62
  "prettier": "3.0.3",
63
63
  "rollup": "4.1.0",