Skip to content

Commit

Permalink
Reduce npm package size
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Oct 2, 2022
1 parent 72e5649 commit 3124e2f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
15 changes: 10 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
},
"dependencies": {
"is-plain-obj": "^4.1.0",
"moize": "^6.1.1",
"wild-wild-parser": "^3.2.0"
},
"devDependencies": {
Expand Down
8 changes: 2 additions & 6 deletions src/iterate/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import moize from 'moize'
import { normalizePath, normalizeQuery } from 'wild-wild-parser'

import { getOptions } from './options.js'
Expand Down Expand Up @@ -55,18 +54,15 @@ export const get = function (target, query, opts) {

const normalizeArgs = function (query, opts) {
const optsA = getOptions(opts)
const { pathArray, queryArrays } = mNormalizePathOrQuery(query)
const { pathArray, queryArrays } = normalizePathOrQuery(query)
return { opts: optsA, pathArray, queryArrays }
}

// Distinguish between queries that are paths or not
const normalizePathOrQuery = function (query) {
export const normalizePathOrQuery = function (query) {
try {
return { pathArray: normalizePath(query) }
} catch {
return { queryArrays: normalizeQuery(query) }
}
}

// Due to memoization, `entry.path[*]` items should not be mutated by consumers
const mNormalizePathOrQuery = moize(normalizePathOrQuery, { maxSize: 1e3 })

0 comments on commit 3124e2f

Please sign in to comment.