Skip to content

Commit bd9d85e

Browse files
authored
remove need for 'count-array-values' (github#24867)
1 parent 1e14ea1 commit bd9d85e

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

package-lock.json

-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@
125125
"chalk": "^5.0.0",
126126
"change-case": "^4.1.2",
127127
"commander": "^8.3.0",
128-
"count-array-values": "^1.2.1",
129128
"cross-env": "^7.0.3",
130129
"csp-parse": "0.0.2",
131130
"dedent": "^0.7.0",

script/search/validate-records.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
#!/usr/bin/env node
22
import assert from 'assert'
33
import { isArray, isString } from 'lodash-es'
4-
import countArrayValues from 'count-array-values'
4+
5+
function countArrayValues(arr) {
6+
const counter = new Map()
7+
arr.forEach((value) => counter.set(value, (counter.get(value) || 0) + 1))
8+
return [...counter.entries()].map(([value, count]) => {
9+
return { value, count }
10+
})
11+
}
512

613
export default function validateRecords(name, records) {
714
assert(isString(name) && name.length, '`name` is required')

0 commit comments

Comments
 (0)