Skip to content

Commit

Permalink
fix: missing type check on sortScripts (#139)
Browse files Browse the repository at this point in the history
* fix: missing type check on `sortScripts`

* perf: skip type check inside `sortScripts`
  • Loading branch information
fisker authored and keithamus committed Jan 10, 2020
1 parent 195a6b7 commit 869178f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const defaultNpmScripts = new Set([
'version',
])

const sortScripts = scripts => {
const sortScripts = onObject(scripts => {
const names = Object.keys(scripts)
const prefixable = new Set()

Expand All @@ -136,8 +136,8 @@ const sortScripts = scripts => {
[],
)

return sortObjectBy(order)(scripts)
}
return sortObjectKeys(scripts, order)
})

// fields marked `vscode` are for `Visual Studio Code extension manifest` only
// https://code.visualstudio.com/api/references/extension-manifest
Expand Down
4 changes: 2 additions & 2 deletions tests/_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ function asItIs(t, { path, options }, excludeTypes = []) {
)
}

for (const value of ['string', false, 2020]) {
const type = typeof value
for (const value of ['string', false, 2020, undefined, null]) {
const type = value === null ? 'null' : typeof value
if (!excludeTypes.includes(type)) {
t.is(
sortPackageJsonAsObject({ path, value, options }),
Expand Down

0 comments on commit 869178f

Please sign in to comment.