MCPcopy Index your code
hub / github.com/nodejs/node / getValidateFactory

Function getValidateFactory

benchmark/validators/validate-x-array.js:22–40  ·  view source on GitHub ↗
(type, arrayLength)

Source from the content-addressed store, hash-verified

20});
21
22function getValidateFactory(type, arrayLength) {
23 const {
24 validateBooleanArray,
25 validateStringArray,
26 } = require('internal/validators');
27
28 switch (type) {
29 case 'validateBooleanArray':
30 return [
31 (n) => validateBooleanArray(n, 'n'),
32 Array.from({ length: arrayLength }, (v, i) => ((i & 1) === 0)),
33 ];
34 case 'validateStringArray':
35 return [
36 (n) => validateStringArray(n, 'n'),
37 Array.from({ length: arrayLength }, (v, i) => `foo${i}`),
38 ];
39 }
40}
41
42function main({ n, type, arrayLength }) {
43 const [validate, value] = getValidateFactory(type, arrayLength);

Callers 1

mainFunction · 0.70

Calls 2

requireFunction · 0.50
fromMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…