Skip to content

Commit 6810df3

Browse files
committed
update
1 parent dde82ff commit 6810df3

File tree

5 files changed

+44
-3
lines changed

5 files changed

+44
-3
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ module.exports = function variableCompress(opts) {
7272
pureSkips = [];
7373
scriptBasedSkips = [];
7474
cssVariablesMap = new Map();
75-
opts.forEach(E => {
75+
opts === null || opts === void 0 ? void 0 : opts.forEach(E => {
7676
if (typeof E === 'string') {
7777
let name = E;
7878
let cssName = E;

index.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,8 @@ it('Support reloading. Now the plugin will reset mapped variables', async () =>
9292
await run(`:root{--first-color: #16f;--second-color: #ff7;}`, `:root{--0: #16f;--1: #ff7;}`, []);
9393
await run(`:root{--second-color: #ff7;--first-color: #16f;}`, `:root{--0: #ff7;--1: #16f;}`, []);
9494
});
95+
96+
97+
it('Base array check or no array', async () => {
98+
await run(`:root{}`, `:root{}`);
99+
});

index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function map(j: import('postcss').Declaration) {
9494
}
9595

9696

97-
module.exports = function variableCompress(opts: variableCompress.parameters[]) {
97+
module.exports = function variableCompress(opts?: variableCompress.parameters[]) {
9898

9999
processed = Symbol('processed');
100100

@@ -104,7 +104,7 @@ module.exports = function variableCompress(opts: variableCompress.parameters[])
104104
scriptBasedSkips = [];
105105
cssVariablesMap = new Map();
106106

107-
opts.forEach(E => {
107+
opts?.forEach(E => {
108108
if (typeof E === 'string') {
109109

110110
let name = E;

package-lock.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
"postcss": "^8.2.8"
2525
},
2626
"devDependencies": {
27+
"@types/jest": "^27.4.0",
28+
"@types/mocha": "^9.1.0",
2729
"clean-publish": "^3.4.2",
2830
"eslint": "^8.0.1",
2931
"eslint-plugin-jest": "^25.2.2",

0 commit comments

Comments
 (0)