Skip to content

Commit 869178f

Browse files
fiskerkeithamus
authored andcommitted
fix: missing type check on sortScripts (#139)
* fix: missing type check on `sortScripts` * perf: skip type check inside `sortScripts`
1 parent 195a6b7 commit 869178f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const defaultNpmScripts = new Set([
113113
'version',
114114
])
115115

116-
const sortScripts = scripts => {
116+
const sortScripts = onObject(scripts => {
117117
const names = Object.keys(scripts)
118118
const prefixable = new Set()
119119

@@ -136,8 +136,8 @@ const sortScripts = scripts => {
136136
[],
137137
)
138138

139-
return sortObjectBy(order)(scripts)
140-
}
139+
return sortObjectKeys(scripts, order)
140+
})
141141

142142
// fields marked `vscode` are for `Visual Studio Code extension manifest` only
143143
// https://code.visualstudio.com/api/references/extension-manifest

tests/_helpers.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ function asItIs(t, { path, options }, excludeTypes = []) {
8585
)
8686
}
8787

88-
for (const value of ['string', false, 2020]) {
89-
const type = typeof value
88+
for (const value of ['string', false, 2020, undefined, null]) {
89+
const type = value === null ? 'null' : typeof value
9090
if (!excludeTypes.includes(type)) {
9191
t.is(
9292
sortPackageJsonAsObject({ path, value, options }),

0 commit comments

Comments
 (0)