Skip to content

Commit 783427c

Browse files
chore: update serialize-javascript (#662)
1 parent 543da6e commit 783427c

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"npm-run-all": "^4.1.5",
9393
"prettier": "^3.6.0",
9494
"prettier-2": "npm:prettier@^2",
95-
"serialize-javascript": "^7.0.4",
95+
"serialize-javascript": "^7.0.5",
9696
"standard-version": "^9.3.1",
9797
"typescript": "^5.9.2",
9898
"uglify-js": "^3.19.3",

src/serialize-javascript.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ module.exports = function serialize(obj, options) {
145145
return '@__S-' + UID + '-' + (sets.push(origValue) - 1) + '__@';
146146
}
147147

148-
if(origValue instanceof Array) {
149-
var isSparse = origValue.filter(function(){return true}).length !== origValue.length;
148+
if(Array.isArray(origValue)) {
149+
var isSparse = Object.keys(origValue).length !== origValue.length;
150150
if (isSparse) {
151151
return '@__A-' + UID + '-' + (arrays.push(origValue) - 1) + '__@';
152152
}

0 commit comments

Comments
 (0)