string-extract-sass-vars 3.0.5 → 3.0.11

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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2010-2021 Roy Revelt and other contributors
3
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -26,18 +26,17 @@
26
26
 
27
27
  ## Install
28
28
 
29
- This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required:
29
+ The latest version is **ESM only**: Node 12+ is needed to use it and it must be `import`ed instead of `require`d. If your project is not on ESM yet and you want to use `require`, use an older version of this program, `2.1.0`.
30
30
 
31
31
  ```bash
32
32
  npm i string-extract-sass-vars
33
33
  ```
34
34
 
35
- If you need a legacy version which works with `require`, use version 2.1.0
36
-
37
35
  ## Quick Take
38
36
 
39
37
  ```js
40
38
  import { strict as assert } from "assert";
39
+
41
40
  import { extractVars } from "string-extract-sass-vars";
42
41
 
43
42
  assert.deepEqual(
@@ -70,7 +69,7 @@ $customValue3: 10;`),
70
69
 
71
70
  ## Documentation
72
71
 
73
- Please [visit codsen.com](https://codsen.com/os/string-extract-sass-vars/) for a full description of the API and examples.
72
+ Please [visit codsen.com](https://codsen.com/os/string-extract-sass-vars/) for a full description of the API.
74
73
 
75
74
  ## Contributing
76
75
 
@@ -80,6 +79,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
80
79
 
81
80
  MIT License
82
81
 
83
- Copyright (c) 2010-2021 Roy Revelt and other contributors
82
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
84
83
 
85
84
  <img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
@@ -1,92 +1,11 @@
1
1
  /**
2
2
  * @name string-extract-sass-vars
3
3
  * @fileoverview Parse SASS variables file into a plain object of CSS key-value pairs
4
- * @version 3.0.5
4
+ * @version 3.0.11
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-extract-sass-vars/}
8
8
  */
9
9
 
10
- var version$1 = "3.0.5";
11
-
12
- const version = version$1;
13
- const BACKSLASH = "\u005C";
14
- const defaults = {
15
- throwIfEmpty: false,
16
- cb: null
17
- };
18
- function extractVars(str, originalOpts) {
19
- if (typeof str !== "string") {
20
- return {};
21
- }
22
- if (originalOpts && typeof originalOpts !== "object") {
23
- throw new Error(`string-extract-sass-vars: [THROW_ID_01] the second input argument should be a plain object but it was given as ${JSON.stringify(originalOpts, null, 4)} (type ${typeof originalOpts})`);
24
- }
25
- const opts = { ...defaults,
26
- ...originalOpts
27
- };
28
- if (opts.cb && typeof opts.cb !== "function") {
29
- throw new Error(`string-extract-sass-vars: [THROW_ID_02] opts.cb should be function! But it was given as ${JSON.stringify(originalOpts, null, 4)} (type ${typeof originalOpts})`);
30
- }
31
- const len = str.length;
32
- let varNameStartsAt = null;
33
- let varValueStartsAt = null;
34
- let varName = null;
35
- let varValue = null;
36
- let withinQuotes = null;
37
- let lastNonQuoteCharAt = null;
38
- let withinComments = false;
39
- let withinSlashSlashComment = false;
40
- let withinSlashAsteriskComment = false;
41
- const res = {};
42
- for (let i = 0; i < len; i++) {
43
- if (!withinComments && withinQuotes && str[i] === withinQuotes && str[i - 1] !== BACKSLASH) {
44
- withinQuotes = null;
45
- }
46
- else if (!withinQuotes && !withinComments && str[i - 1] !== BACKSLASH && `'"`.includes(str[i])) {
47
- withinQuotes = str[i];
48
- }
49
- if (withinSlashSlashComment && `\r\n`.includes(str[i])) {
50
- withinSlashSlashComment = false;
51
- }
52
- if (!withinComments && str[i] === "/" && str[i + 1] === "/") {
53
- withinSlashSlashComment = true;
54
- }
55
- if (withinSlashAsteriskComment && str[i - 2] === "*" && str[i - 1] === "/") {
56
- withinSlashAsteriskComment = false;
57
- }
58
- if (!withinComments && str[i] === "/" && str[i + 1] === "*") {
59
- withinSlashAsteriskComment = true;
60
- }
61
- withinComments = withinSlashSlashComment || withinSlashAsteriskComment;
62
- if (!withinComments && str[i] === "$" && varNameStartsAt === null) {
63
- varNameStartsAt = i + 1;
64
- }
65
- if (!withinComments && varValueStartsAt !== null && !withinQuotes && str[i] === ";") {
66
- varValue = str.slice(!`"'`.includes(str[varValueStartsAt]) ? varValueStartsAt : varValueStartsAt + 1, (lastNonQuoteCharAt || 0) + 1);
67
- if (/^-?\d*\.?\d*$/.test(varValue)) {
68
- varValue = +varValue;
69
- }
70
- res[varName] = opts.cb ? opts.cb(varValue) : varValue;
71
- varNameStartsAt = null;
72
- varValueStartsAt = null;
73
- varName = null;
74
- varValue = null;
75
- }
76
- if (!withinComments && varName !== null && str[i] && str[i].trim().length && varValueStartsAt === null) {
77
- varValueStartsAt = i;
78
- }
79
- if (!withinComments && !varName && varNameStartsAt !== null && str[i] === ":" && !withinQuotes) {
80
- varName = str.slice(varNameStartsAt, i);
81
- }
82
- if (!`'"`.includes(str[i])) {
83
- lastNonQuoteCharAt = i;
84
- }
85
- }
86
- if (!Object.keys(res).length && opts.throwIfEmpty) {
87
- throw new Error(`string-extract-sass-vars: [THROW_ID_03] no keys extracted! (setting opts.originalOpts)`);
88
- }
89
- return res;
90
- }
91
-
92
- export { defaults, extractVars, version };
10
+ var h="3.0.11";var v=h,S="\\",p={throwIfEmpty:!1,cb:null};function w(e,n){if(typeof e!="string")return{};if(n&&typeof n!="object")throw new Error(`string-extract-sass-vars: [THROW_ID_01] the second input argument should be a plain object but it was given as ${JSON.stringify(n,null,4)} (type ${typeof n})`);let o={...p,...n};if(o.cb&&typeof o.cb!="function")throw new Error(`string-extract-sass-vars: [THROW_ID_02] opts.cb should be function! But it was given as ${JSON.stringify(n,null,4)} (type ${typeof n})`);let g=e.length,r=null,l=null,$=null,i=null,u=null,c=null,s=!1,a=!1,m=!1,b={};for(let t=0;t<g;t++)!s&&u&&e[t]===u&&e[t-1]!==S?u=null:!u&&!s&&e[t-1]!==S&&`'"`.includes(e[t])&&(u=e[t]),a&&`\r
11
+ `.includes(e[t])&&(a=!1),!s&&e[t]==="/"&&e[t+1]==="/"&&(a=!0),m&&e[t-2]==="*"&&e[t-1]==="/"&&(m=!1),!s&&e[t]==="/"&&e[t+1]==="*"&&(m=!0),s=a||m,!s&&e[t]==="$"&&r===null&&(r=t+1),!s&&l!==null&&!u&&e[t]===";"&&(i=e.slice(`"'`.includes(e[l])?l+1:l,(c||0)+1),/^-?\d*\.?\d*$/.test(i)&&(i=+i),b[$]=o.cb?o.cb(i):i,r=null,l=null,$=null,i=null),!s&&$!==null&&e[t]&&e[t].trim().length&&l===null&&(l=t),!s&&!$&&r!==null&&e[t]===":"&&!u&&($=e.slice(r,t)),`'"`.includes(e[t])||(c=t);if(!Object.keys(b).length&&o.throwIfEmpty)throw new Error("string-extract-sass-vars: [THROW_ID_03] no keys extracted! (setting opts.originalOpts)");return b}export{p as defaults,w as extractVars,v as version};
@@ -1,10 +1,11 @@
1
1
  /**
2
2
  * @name string-extract-sass-vars
3
3
  * @fileoverview Parse SASS variables file into a plain object of CSS key-value pairs
4
- * @version 3.0.5
4
+ * @version 3.0.11
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-extract-sass-vars/}
8
8
  */
9
9
 
10
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).stringExtractSassVars={})}(this,(function(t){"use strict";const e={throwIfEmpty:!1,cb:null};t.defaults=e,t.extractVars=function(t,n){if("string"!=typeof t)return{};if(n&&"object"!=typeof n)throw new Error(`string-extract-sass-vars: [THROW_ID_01] the second input argument should be a plain object but it was given as ${JSON.stringify(n,null,4)} (type ${typeof n})`);const l={...e,...n};if(l.cb&&"function"!=typeof l.cb)throw new Error(`string-extract-sass-vars: [THROW_ID_02] opts.cb should be function! But it was given as ${JSON.stringify(n,null,4)} (type ${typeof n})`);const s=t.length;let r=null,o=null,i=null,u=null,c=null,f=null,a=!1,d=!1,p=!1;const y={};for(let e=0;e<s;e++)!a&&c&&t[e]===c&&"\\"!==t[e-1]?c=null:c||a||"\\"===t[e-1]||!"'\"".includes(t[e])||(c=t[e]),d&&"\r\n".includes(t[e])&&(d=!1),a||"/"!==t[e]||"/"!==t[e+1]||(d=!0),p&&"*"===t[e-2]&&"/"===t[e-1]&&(p=!1),a||"/"!==t[e]||"*"!==t[e+1]||(p=!0),a=d||p,a||"$"!==t[e]||null!==r||(r=e+1),a||null===o||c||";"!==t[e]||(u=t.slice("\"'".includes(t[o])?o+1:o,(f||0)+1),/^-?\d*\.?\d*$/.test(u)&&(u=+u),y[i]=l.cb?l.cb(u):u,r=null,o=null,i=null,u=null),!a&&null!==i&&t[e]&&t[e].trim().length&&null===o&&(o=e),a||i||null===r||":"!==t[e]||c||(i=t.slice(r,e)),"'\"".includes(t[e])||(f=e);if(!Object.keys(y).length&&l.throwIfEmpty)throw new Error("string-extract-sass-vars: [THROW_ID_03] no keys extracted! (setting opts.originalOpts)");return y},t.version="3.0.5",Object.defineProperty(t,"__esModule",{value:!0})}));
10
+ var stringExtractSassVars=(()=>{var c=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols;var p=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var y=(t,e,s)=>e in t?c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,S=(t,e)=>{for(var s in e||(e={}))p.call(e,s)&&y(t,s,e[s]);if(f)for(var s of f(e))N.call(e,s)&&y(t,s,e[s]);return t};var D=t=>c(t,"__esModule",{value:!0});var C=(t,e)=>{for(var s in e)c(t,s,{get:e[s],enumerable:!0})},A=(t,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of V(e))!p.call(t,l)&&(s||l!=="default")&&c(t,l,{get:()=>e[l],enumerable:!(a=E(e,l))||a.enumerable});return t};var x=(t=>(e,s)=>t&&t.get(e)||(s=A(D({}),e,1),t&&t.set(e,s),s))(typeof WeakMap!="undefined"?new WeakMap:0);var j={};C(j,{defaults:()=>w,extractVars:()=>J,version:()=>k});var d="3.0.11";var k=d,v="\\",w={throwIfEmpty:!1,cb:null};function J(t,e){var T;if(typeof t!="string")return{};if(e&&typeof e!="object")throw new Error(`string-extract-sass-vars: [THROW_ID_01] the second input argument should be a plain object but it was given as ${JSON.stringify(e,null,4)} (type ${typeof e})`);let s=S(S({},w),e);if(s.cb&&typeof s.cb!="function")throw new Error(`string-extract-sass-vars: [THROW_ID_02] opts.cb should be function! But it was given as ${JSON.stringify(e,null,4)} (type ${typeof e})`);let a=t.length,l=null,u=null,$=null,o=null,r=null,g=null,i=!1,m=!1,b=!1,h={};for(let n=0;n<a;n++)!i&&r&&t[n]===r&&t[n-1]!==v?r=null:!r&&!i&&t[n-1]!==v&&`'"`.includes(t[n])&&(r=t[n]),m&&`\r
11
+ `.includes(t[n])&&(m=!1),!i&&t[n]==="/"&&t[n+1]==="/"&&(m=!0),b&&t[n-2]==="*"&&t[n-1]==="/"&&(b=!1),!i&&t[n]==="/"&&t[n+1]==="*"&&(b=!0),i=m||b,!i&&t[n]==="$"&&l===null&&(l=n+1),!i&&u!==null&&!r&&t[n]===";"&&(o=t.slice(`"'`.includes(t[u])?u+1:u,(g||0)+1),/^-?\d*\.?\d*$/.test(o)&&(o=+o),h[$]=s.cb?s.cb(o):o,l=null,u=null,$=null,o=null),!i&&$!==null&&t[n]&&t[n].trim().length&&u===null&&(u=n),!i&&!$&&l!==null&&t[n]===":"&&!r&&($=t.slice(l,n)),`'"`.includes(t[n])||(g=n);if(!Object.keys(h).length&&s.throwIfEmpty)throw new Error("string-extract-sass-vars: [THROW_ID_03] no keys extracted! (setting opts.originalOpts)");return h}return x(j);})();
@@ -1,6 +1,7 @@
1
1
  // Quick Take
2
2
 
3
3
  import { strict as assert } from "assert";
4
+
4
5
  import { extractVars } from "../dist/string-extract-sass-vars.esm.js";
5
6
 
6
7
  assert.deepEqual(
@@ -1,10 +1,11 @@
1
1
  // Convert 3-digit color hex codes to 6-digit
2
2
 
3
3
  import { strict as assert } from "assert";
4
+ import { conv } from "color-shorthand-hex-to-six-digit";
5
+
4
6
  import { extractVars } from "../dist/string-extract-sass-vars.esm.js";
5
7
  // import "color-shorthand-hex-to-six-digit" to convert three-digit colour hex
6
8
  // codes to six-digit:
7
- import { conv } from "../../color-shorthand-hex-to-six-digit/dist/color-shorthand-hex-to-six-digit.esm.js";
8
9
 
9
10
  assert.deepEqual(
10
11
  extractVars("$blue: #2af;", {
@@ -1,6 +1,7 @@
1
1
  // Raises alarm if variables file has been wiped
2
2
 
3
3
  import { strict as assert } from "assert";
4
+
4
5
  import { extractVars } from "../dist/string-extract-sass-vars.esm.js";
5
6
 
6
7
  assert.throws(() =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-extract-sass-vars",
3
- "version": "3.0.5",
3
+ "version": "3.0.11",
4
4
  "description": "Parse SASS variables file into a plain object of CSS key-value pairs",
5
5
  "keywords": [
6
6
  "css",
@@ -35,39 +35,30 @@
35
35
  },
36
36
  "types": "types/index.d.ts",
37
37
  "scripts": {
38
- "build": "rollup -c",
39
- "ci_test": "npm run build && npm run format && tap --no-only --reporter=silent --output-file=testStats.md && npm run clean_cov",
40
- "clean_cov": "../../scripts/leaveCoverageTotalOnly.js",
41
- "clean_types": "../../scripts/cleanTypes.js",
42
- "dev": "rollup -c --dev",
43
- "devunittest": "npm run dev && tap --only -R 'base'",
44
- "esbuild": "node '../../scripts/esbuild.js'",
45
- "esbuild_dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
46
- "format": "npm run lect && npm run prettier && npm run lint",
47
- "lect": "lect",
48
- "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
49
- "perf": "node perf/check",
50
- "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
51
- "republish": "npm publish || :",
52
- "tap": "tap",
53
- "pretest": "npm run build",
54
- "test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
55
- "test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
56
- "tsc": "tsc",
57
- "unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf"
38
+ "build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
39
+ "dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
40
+ "dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
41
+ "examples": "node '../../ops/scripts/run-examples.js'",
42
+ "lect": "node '../../ops/lect/lect.js'",
43
+ "letspublish": "yarn publish || :",
44
+ "lint": "eslint . --fix",
45
+ "perf": "node perf/check.js",
46
+ "prepare": "echo 'ready'",
47
+ "prettier": "prettier",
48
+ "prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
49
+ "pretest": "yarn run lect && yarn run build",
50
+ "test": "c8 yarn run unit && yarn run examples && yarn run lint",
51
+ "unit": "uvu test"
58
52
  },
59
- "tap": {
60
- "check-coverage": false,
61
- "coverage-report": [
62
- "json-summary",
63
- "text"
64
- ],
65
- "node-arg": [
66
- "--no-warnings",
67
- "--experimental-loader",
68
- "@istanbuljs/esm-loader-hook"
53
+ "engines": {
54
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
55
+ },
56
+ "c8": {
57
+ "check-coverage": true,
58
+ "exclude": [
59
+ "**/test/**/*.*"
69
60
  ],
70
- "timeout": 0
61
+ "lines": 100
71
62
  },
72
63
  "lect": {
73
64
  "licence": {
@@ -75,53 +66,9 @@
75
66
  ""
76
67
  ]
77
68
  },
78
- "req": "{ extractVars }",
79
- "various": {
80
- "devDependencies": []
81
- }
82
- },
83
- "dependencies": {
84
- "@babel/runtime": "^7.16.0"
69
+ "various": {}
85
70
  },
86
71
  "devDependencies": {
87
- "@babel/cli": "^7.16.0",
88
- "@babel/core": "^7.16.0",
89
- "@babel/node": "^7.16.0",
90
- "@babel/plugin-external-helpers": "^7.16.0",
91
- "@babel/plugin-proposal-class-properties": "^7.16.0",
92
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
93
- "@babel/plugin-proposal-object-rest-spread": "^7.16.0",
94
- "@babel/plugin-proposal-optional-chaining": "^7.16.0",
95
- "@babel/plugin-transform-runtime": "^7.16.0",
96
- "@babel/preset-env": "^7.16.0",
97
- "@babel/preset-typescript": "^7.16.0",
98
- "@babel/register": "^7.16.0",
99
- "@istanbuljs/esm-loader-hook": "^0.1.2",
100
- "@rollup/plugin-babel": "^5.3.0",
101
- "@rollup/plugin-commonjs": "^21.0.1",
102
- "@rollup/plugin-json": "^4.1.0",
103
- "@rollup/plugin-node-resolve": "^13.0.6",
104
- "@rollup/plugin-strip": "^2.1.0",
105
- "@rollup/plugin-typescript": "^8.3.0",
106
- "@types/node": "^16.11.6",
107
- "@types/tap": "^15.0.5",
108
- "@typescript-eslint/eslint-plugin": "^5.3.0",
109
- "@typescript-eslint/parser": "^5.3.0",
110
- "core-js": "^3.19.1",
111
- "cross-env": "^7.0.3",
112
- "eslint": "^8.2.0",
113
- "lect": "^0.18.5",
114
- "rollup": "^2.59.0",
115
- "rollup-plugin-ascii": "^0.0.3",
116
- "rollup-plugin-banner": "^0.2.1",
117
- "rollup-plugin-cleanup": "^3.2.1",
118
- "rollup-plugin-dts": "^4.0.1",
119
- "rollup-plugin-terser": "^7.0.2",
120
- "tap": "^15.0.10",
121
- "tslib": "^2.3.1",
122
- "typescript": "^4.4.4"
123
- },
124
- "engines": {
125
- "node": ">=12"
72
+ "color-shorthand-hex-to-six-digit": "^4.0.11"
126
73
  }
127
74
  }
package/types/index.d.ts CHANGED
@@ -1,12 +1,15 @@
1
1
  declare const version: string;
2
2
  interface UnknownValueObj {
3
- [key: string]: any;
3
+ [key: string]: any;
4
4
  }
5
5
  interface Opts {
6
- throwIfEmpty?: boolean;
7
- cb?: null | ((varValue: string) => any);
6
+ throwIfEmpty?: boolean;
7
+ cb?: null | ((varValue: string) => any);
8
8
  }
9
9
  declare const defaults: Opts;
10
- declare function extractVars(str: string, originalOpts?: Partial<Opts>): UnknownValueObj;
10
+ declare function extractVars(
11
+ str: string,
12
+ originalOpts?: Partial<Opts>
13
+ ): UnknownValueObj;
11
14
 
12
15
  export { defaults, extractVars, version };
package/examples/api.json DELETED
@@ -1 +0,0 @@
1
- {"_quickTake.js":{"title":"Quick Take","content":"import &#x7B; strict as assert &#x7D; from \"assert\";\nimport &#x7B; extractVars &#x7D; from \"string-extract-sass-vars\";\n\nassert.deepEqual(\n extractVars(`// all variables are here!!!\n// ------------------------------------------\n$red: #ff6565; // this is red\n// $green: #63ffbd; // no green here\n$yellow: #ffff65; // this is yellow\n$blue: #08f0fd; // this is blue\n$fontfamily: Helvetica, sans-serif;\n$border: 1px solid #dedede;\n$borderroundedness: 3px;\n$customValue1: tralala;\n$customValue2: tralala;\n// don't mind this comment about #ff6565;\n$customValue3: 10;`),\n &#x7B;\n red: \"#ff6565\",\n yellow: \"#ffff65\",\n blue: \"#08f0fd\",\n fontfamily: \"Helvetica, sans-serif\",\n border: \"1px solid #dedede\",\n borderroundedness: \"3px\",\n customValue1: \"tralala\",\n customValue2: \"tralala\",\n customValue3: 10,\n &#x7D;\n);"},"opts-cb.js":{"title":"Convert 3-digit color hex codes to 6-digit","content":"import &#x7B; strict as assert &#x7D; from \"assert\";\nimport &#x7B; extractVars &#x7D; from \"string-extract-sass-vars\";\n// import \"color-shorthand-hex-to-six-digit\" to convert three-digit colour hex\n// codes to six-digit:\nimport &#x7B; conv &#x7D; from \"color-shorthand-hex-to-six-digit\";\n\nassert.deepEqual(\n extractVars(\"$blue: #2af;\", &#x7B;\n throwIfEmpty: true,\n cb: (val) => conv(val), // converts hex codes only, bypasses the rest\n &#x7D;),\n &#x7B; blue: \"#22aaff\" &#x7D;\n);"},"throw-if-empty.js":{"title":"Raises alarm if variables file has been wiped","content":"import &#x7B; strict as assert &#x7D; from \"assert\";\nimport &#x7B; extractVars &#x7D; from \"string-extract-sass-vars\";\n\nassert.throws(() =>\n extractVars(\"\", &#x7B;\n throwIfEmpty: true,\n &#x7D;)\n);"}}