@innet/server 2.0.0-beta.10 → 2.0.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hooks/useSchemaType/useSchemaType.es6.js +10 -1
- package/hooks/useSchemaType/useSchemaType.js +10 -1
- package/index.es6.js +1 -1
- package/index.js +1 -0
- package/package.json +2 -2
- package/plugins/main/api/api.es6.js +5 -4
- package/plugins/main/api/api.js +4 -3
- package/plugins/main/server/server.es6.js +4 -2
- package/plugins/main/server/server.js +3 -1
- package/plugins/schema/date/date.es6.js +2 -2
- package/plugins/schema/date/date.js +2 -2
- package/plugins/schema/integer/integer.es6.js +3 -3
- package/plugins/schema/integer/integer.js +3 -3
- package/plugins/schema/number/number.es6.js +2 -2
- package/plugins/schema/number/number.js +1 -1
- package/plugins/schema/string/string.es6.js +2 -2
- package/plugins/schema/string/string.js +1 -1
- package/plugins/schema/uuid/uuid.es6.js +2 -2
- package/plugins/schema/uuid/uuid.js +1 -1
- package/types.d.ts +2 -1
- package/utils/rules/values/index.es6.js +1 -1
- package/utils/rules/values/index.js +1 -0
- package/utils/rules/values/values.d.ts +3 -1
- package/utils/rules/values/values.es6.js +4 -1
- package/utils/rules/values/values.js +4 -0
|
@@ -27,9 +27,18 @@ function useSchemaType(type, { example, examples, ref, values, ...options } = {}
|
|
|
27
27
|
type: type === 'any' ? undefined : type,
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
const arrayValues = values ? Array.isArray(values) ? values : Object.keys(values) : values;
|
|
31
|
+
const enumDescription = values && !Array.isArray(values)
|
|
32
|
+
? {
|
|
33
|
+
'x-enum-descriptions': values,
|
|
34
|
+
'x-enumDescriptions': values,
|
|
35
|
+
'x-enumNames': values,
|
|
36
|
+
}
|
|
37
|
+
: {};
|
|
30
38
|
return useNewSchema({
|
|
31
39
|
...options,
|
|
32
|
-
|
|
40
|
+
...enumDescription,
|
|
41
|
+
enum: arrayValues,
|
|
33
42
|
example,
|
|
34
43
|
examples,
|
|
35
44
|
type: type === 'any' ? undefined : type,
|
|
@@ -31,9 +31,18 @@ function useSchemaType(type, { example, examples, ref, values, ...options } = {}
|
|
|
31
31
|
type: type === 'any' ? undefined : type,
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
+
const arrayValues = values ? Array.isArray(values) ? values : Object.keys(values) : values;
|
|
35
|
+
const enumDescription = values && !Array.isArray(values)
|
|
36
|
+
? {
|
|
37
|
+
'x-enum-descriptions': values,
|
|
38
|
+
'x-enumDescriptions': values,
|
|
39
|
+
'x-enumNames': values,
|
|
40
|
+
}
|
|
41
|
+
: {};
|
|
34
42
|
return useNewSchema.useNewSchema({
|
|
35
43
|
...options,
|
|
36
|
-
|
|
44
|
+
...enumDescription,
|
|
45
|
+
enum: arrayValues,
|
|
37
46
|
example,
|
|
38
47
|
examples,
|
|
39
48
|
type: type === 'any' ? undefined : type,
|
package/index.es6.js
CHANGED
|
@@ -117,5 +117,5 @@ export { pipe } from './utils/rules/pipe/pipe.es6.js';
|
|
|
117
117
|
export { required } from './utils/rules/required/required.es6.js';
|
|
118
118
|
export { tupleOf } from './utils/rules/tupleOf/tupleOf.es6.js';
|
|
119
119
|
export { uuidTo } from './utils/rules/uuidTo/uuidTo.es6.js';
|
|
120
|
-
export { values } from './utils/rules/values/values.es6.js';
|
|
120
|
+
export { getArrayValues, values } from './utils/rules/values/values.es6.js';
|
|
121
121
|
export { stringifySearch } from './utils/stringifySearch/stringifySearch.es6.js';
|
package/index.js
CHANGED
|
@@ -274,5 +274,6 @@ exports.pipe = pipe.pipe;
|
|
|
274
274
|
exports.required = required.required;
|
|
275
275
|
exports.tupleOf = tupleOf.tupleOf;
|
|
276
276
|
exports.uuidTo = uuidTo.uuidTo;
|
|
277
|
+
exports.getArrayValues = values.getArrayValues;
|
|
277
278
|
exports.values = values.values;
|
|
278
279
|
exports.stringifySearch = stringifySearch.stringifySearch;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@innet/server",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.12",
|
|
4
4
|
"description": "Create server-side application with innet",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.es6.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@types/qs": "^6.15.0",
|
|
45
45
|
"cookie": "^1.1.1",
|
|
46
46
|
"http-proxy": "^1.18.1",
|
|
47
|
-
"innet": "^2.1.
|
|
47
|
+
"innet": "^2.1.1",
|
|
48
48
|
"mime": "^4.1.0",
|
|
49
49
|
"multiparty": "^4.2.3",
|
|
50
50
|
"openapi-types": "^12.1.3",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useNewHandler, innet } from 'innet';
|
|
1
|
+
import { useNewHandler, useApp, innet, net } from 'innet';
|
|
2
2
|
import { useProps } from '@innet/jsx';
|
|
3
3
|
import '../../../hooks/index.es6.js';
|
|
4
4
|
import '../../../utils/index.es6.js';
|
|
@@ -39,6 +39,7 @@ const api = () => {
|
|
|
39
39
|
apiContext.set(handler, context);
|
|
40
40
|
useServerPlugin(async () => {
|
|
41
41
|
var _a, _b, _c, _d, _e, _f;
|
|
42
|
+
const app = useApp();
|
|
42
43
|
const action = useAction();
|
|
43
44
|
if (!condition(action))
|
|
44
45
|
return;
|
|
@@ -164,11 +165,11 @@ const api = () => {
|
|
|
164
165
|
}
|
|
165
166
|
}
|
|
166
167
|
for (const plugin of plugins) {
|
|
167
|
-
const result = await plugin();
|
|
168
|
-
if (result === undefined)
|
|
169
|
-
continue;
|
|
170
168
|
const newHandler = Object.create(handler);
|
|
171
169
|
actionContext.set(newHandler, action);
|
|
170
|
+
const result = await net(plugin, app, newHandler);
|
|
171
|
+
if (result === undefined)
|
|
172
|
+
continue;
|
|
172
173
|
innet(result, newHandler);
|
|
173
174
|
return null;
|
|
174
175
|
}
|
package/plugins/main/api/api.js
CHANGED
|
@@ -43,6 +43,7 @@ const api = () => {
|
|
|
43
43
|
useApi.apiContext.set(handler, context);
|
|
44
44
|
useServerPlugin.useServerPlugin(async () => {
|
|
45
45
|
var _a, _b, _c, _d, _e, _f;
|
|
46
|
+
const app = innet.useApp();
|
|
46
47
|
const action = useAction.useAction();
|
|
47
48
|
if (!condition(action))
|
|
48
49
|
return;
|
|
@@ -168,11 +169,11 @@ const api = () => {
|
|
|
168
169
|
}
|
|
169
170
|
}
|
|
170
171
|
for (const plugin of plugins) {
|
|
171
|
-
const result = await plugin();
|
|
172
|
-
if (result === undefined)
|
|
173
|
-
continue;
|
|
174
172
|
const newHandler = Object.create(handler);
|
|
175
173
|
useAction.actionContext.set(newHandler, action);
|
|
174
|
+
const result = await innet.net(plugin, app, newHandler);
|
|
175
|
+
if (result === undefined)
|
|
176
|
+
continue;
|
|
176
177
|
innet.innet(result, newHandler);
|
|
177
178
|
return null;
|
|
178
179
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useNewHandler, innet } from 'innet';
|
|
1
|
+
import { useNewHandler, useApp, useHandler, net, innet } from 'innet';
|
|
2
2
|
import { useProps } from '@innet/jsx';
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import http from 'node:http';
|
|
@@ -56,8 +56,10 @@ const server = () => {
|
|
|
56
56
|
actionContext.set(requestHandler, action);
|
|
57
57
|
requestHandlerContext.set(requestHandler, requestHandler);
|
|
58
58
|
async function server() {
|
|
59
|
+
const app = useApp();
|
|
60
|
+
const handler = useHandler();
|
|
59
61
|
for (const plugin of plugins) {
|
|
60
|
-
const result = await plugin
|
|
62
|
+
const result = await net(plugin, app, handler);
|
|
61
63
|
if (result !== undefined) {
|
|
62
64
|
return result;
|
|
63
65
|
}
|
|
@@ -66,8 +66,10 @@ const server = () => {
|
|
|
66
66
|
useAction.actionContext.set(requestHandler, action);
|
|
67
67
|
useRequestHandler.requestHandlerContext.set(requestHandler, requestHandler);
|
|
68
68
|
async function server() {
|
|
69
|
+
const app = innet.useApp();
|
|
70
|
+
const handler = innet.useHandler();
|
|
69
71
|
for (const plugin of plugins) {
|
|
70
|
-
const result = await plugin
|
|
72
|
+
const result = await innet.net(plugin, app, handler);
|
|
71
73
|
if (result !== undefined) {
|
|
72
74
|
return result;
|
|
73
75
|
}
|
|
@@ -4,10 +4,10 @@ import '../../../hooks/useParentRule/index.es6.js';
|
|
|
4
4
|
import '../../../utils/index.es6.js';
|
|
5
5
|
import '../../../utils/dateFormat/index.es6.js';
|
|
6
6
|
import { dateFormat } from '../../../utils/dateFormat/dateFormat.es6.js';
|
|
7
|
+
import { getArrayValues, values } from '../../../utils/rules/values/values.es6.js';
|
|
7
8
|
import { useSchemaType } from '../../../hooks/useSchemaType/useSchemaType.es6.js';
|
|
8
9
|
import { defaultTo } from '../../../utils/rules/defaultTo/defaultTo.es6.js';
|
|
9
10
|
import { dateTo } from '../../../utils/rules/dateTo/dateTo.es6.js';
|
|
10
|
-
import { values } from '../../../utils/rules/values/values.es6.js';
|
|
11
11
|
import { minDate } from '../../../utils/rules/minDate/minDate.es6.js';
|
|
12
12
|
import { maxDate } from '../../../utils/rules/maxDate/maxDate.es6.js';
|
|
13
13
|
import { useParentRule } from '../../../hooks/useParentRule/useParentRule.es6.js';
|
|
@@ -20,7 +20,7 @@ const date = () => {
|
|
|
20
20
|
const normMax = dateFormat(max);
|
|
21
21
|
const normDefault = dateFormat(defaultValue);
|
|
22
22
|
const normExample = dateFormat(example);
|
|
23
|
-
const normValues = values$1
|
|
23
|
+
const normValues = values$1 && getArrayValues(values$1, dateFormat);
|
|
24
24
|
// @ts-expect-error: FIXME
|
|
25
25
|
const stringValues = normValues === null || normValues === void 0 ? void 0 : normValues.map(value => value.toISOString());
|
|
26
26
|
const normExamples = examples === null || examples === void 0 ? void 0 : examples.map(dateFormat);
|
|
@@ -8,10 +8,10 @@ require('../../../hooks/useParentRule/index.js');
|
|
|
8
8
|
require('../../../utils/index.js');
|
|
9
9
|
require('../../../utils/dateFormat/index.js');
|
|
10
10
|
var dateFormat = require('../../../utils/dateFormat/dateFormat.js');
|
|
11
|
+
var values = require('../../../utils/rules/values/values.js');
|
|
11
12
|
var useSchemaType = require('../../../hooks/useSchemaType/useSchemaType.js');
|
|
12
13
|
var defaultTo = require('../../../utils/rules/defaultTo/defaultTo.js');
|
|
13
14
|
var dateTo = require('../../../utils/rules/dateTo/dateTo.js');
|
|
14
|
-
var values = require('../../../utils/rules/values/values.js');
|
|
15
15
|
var minDate = require('../../../utils/rules/minDate/minDate.js');
|
|
16
16
|
var maxDate = require('../../../utils/rules/maxDate/maxDate.js');
|
|
17
17
|
var useParentRule = require('../../../hooks/useParentRule/useParentRule.js');
|
|
@@ -24,7 +24,7 @@ const date = () => {
|
|
|
24
24
|
const normMax = dateFormat.dateFormat(max);
|
|
25
25
|
const normDefault = dateFormat.dateFormat(defaultValue);
|
|
26
26
|
const normExample = dateFormat.dateFormat(example);
|
|
27
|
-
const normValues = values$1
|
|
27
|
+
const normValues = values$1 && values.getArrayValues(values$1, dateFormat.dateFormat);
|
|
28
28
|
// @ts-expect-error: FIXME
|
|
29
29
|
const stringValues = normValues === null || normValues === void 0 ? void 0 : normValues.map(value => value.toISOString());
|
|
30
30
|
const normExamples = examples === null || examples === void 0 ? void 0 : examples.map(dateFormat.dateFormat);
|
|
@@ -2,9 +2,9 @@ import { useProps } from '@innet/jsx';
|
|
|
2
2
|
import '../../../hooks/index.es6.js';
|
|
3
3
|
import '../../../utils/index.es6.js';
|
|
4
4
|
import { useSchemaType } from '../../../hooks/useSchemaType/useSchemaType.es6.js';
|
|
5
|
+
import { getArrayValues, values } from '../../../utils/rules/values/values.es6.js';
|
|
5
6
|
import { defaultTo } from '../../../utils/rules/defaultTo/defaultTo.es6.js';
|
|
6
7
|
import { int } from '../../../utils/rules/int/int.es6.js';
|
|
7
|
-
import { values } from '../../../utils/rules/values/values.es6.js';
|
|
8
8
|
import { min } from '../../../utils/rules/min/min.es6.js';
|
|
9
9
|
import { max } from '../../../utils/rules/max/max.es6.js';
|
|
10
10
|
import { useRule } from '../../../hooks/useRule/useRule.es6.js';
|
|
@@ -19,7 +19,7 @@ const integer = () => {
|
|
|
19
19
|
default: defaultValue !== undefined ? Number(defaultValue) : undefined,
|
|
20
20
|
example: example !== undefined ? Number(example) : undefined,
|
|
21
21
|
examples: examples === null || examples === void 0 ? void 0 : examples.map(Number),
|
|
22
|
-
values: values$1
|
|
22
|
+
values: values$1 && getArrayValues(values$1, Number),
|
|
23
23
|
});
|
|
24
24
|
if (schema) {
|
|
25
25
|
if (format) {
|
|
@@ -47,7 +47,7 @@ const integer = () => {
|
|
|
47
47
|
}
|
|
48
48
|
rules.push(int(format));
|
|
49
49
|
if (values$1) {
|
|
50
|
-
rules.push(values(values$1
|
|
50
|
+
rules.push(values(getArrayValues(values$1, int(format))));
|
|
51
51
|
}
|
|
52
52
|
if (min$1 !== undefined) {
|
|
53
53
|
rules.push(min(min$1));
|
|
@@ -6,9 +6,9 @@ var jsx = require('@innet/jsx');
|
|
|
6
6
|
require('../../../hooks/index.js');
|
|
7
7
|
require('../../../utils/index.js');
|
|
8
8
|
var useSchemaType = require('../../../hooks/useSchemaType/useSchemaType.js');
|
|
9
|
+
var values = require('../../../utils/rules/values/values.js');
|
|
9
10
|
var defaultTo = require('../../../utils/rules/defaultTo/defaultTo.js');
|
|
10
11
|
var int = require('../../../utils/rules/int/int.js');
|
|
11
|
-
var values = require('../../../utils/rules/values/values.js');
|
|
12
12
|
var min = require('../../../utils/rules/min/min.js');
|
|
13
13
|
var max = require('../../../utils/rules/max/max.js');
|
|
14
14
|
var useRule = require('../../../hooks/useRule/useRule.js');
|
|
@@ -23,7 +23,7 @@ const integer = () => {
|
|
|
23
23
|
default: defaultValue !== undefined ? Number(defaultValue) : undefined,
|
|
24
24
|
example: example !== undefined ? Number(example) : undefined,
|
|
25
25
|
examples: examples === null || examples === void 0 ? void 0 : examples.map(Number),
|
|
26
|
-
values: values$1
|
|
26
|
+
values: values$1 && values.getArrayValues(values$1, Number),
|
|
27
27
|
});
|
|
28
28
|
if (schema) {
|
|
29
29
|
if (format) {
|
|
@@ -51,7 +51,7 @@ const integer = () => {
|
|
|
51
51
|
}
|
|
52
52
|
rules.push(int.int(format));
|
|
53
53
|
if (values$1) {
|
|
54
|
-
rules.push(values.values(values$1
|
|
54
|
+
rules.push(values.values(values.getArrayValues(values$1, int.int(format))));
|
|
55
55
|
}
|
|
56
56
|
if (min$1 !== undefined) {
|
|
57
57
|
rules.push(min.min(min$1));
|
|
@@ -5,7 +5,7 @@ import '../../../utils/index.es6.js';
|
|
|
5
5
|
import { useSchemaType } from '../../../hooks/useSchemaType/useSchemaType.es6.js';
|
|
6
6
|
import { defaultTo } from '../../../utils/rules/defaultTo/defaultTo.es6.js';
|
|
7
7
|
import { num } from '../../../utils/rules/num/num.es6.js';
|
|
8
|
-
import { values } from '../../../utils/rules/values/values.es6.js';
|
|
8
|
+
import { values, getArrayValues } from '../../../utils/rules/values/values.es6.js';
|
|
9
9
|
import { min } from '../../../utils/rules/min/min.es6.js';
|
|
10
10
|
import { max } from '../../../utils/rules/max/max.es6.js';
|
|
11
11
|
import { useParentRule } from '../../../hooks/useParentRule/useParentRule.es6.js';
|
|
@@ -41,7 +41,7 @@ const number = () => {
|
|
|
41
41
|
}
|
|
42
42
|
rules.push(num);
|
|
43
43
|
if (props.values) {
|
|
44
|
-
rules.push(values(props.values));
|
|
44
|
+
rules.push(values(getArrayValues(props.values, Number)));
|
|
45
45
|
}
|
|
46
46
|
if (min$1 !== undefined) {
|
|
47
47
|
rules.push(min(min$1));
|
|
@@ -5,7 +5,7 @@ import '../../../utils/index.es6.js';
|
|
|
5
5
|
import { useApi } from '../../../hooks/useApi/useApi.es6.js';
|
|
6
6
|
import { useSchemaType } from '../../../hooks/useSchemaType/useSchemaType.es6.js';
|
|
7
7
|
import { defaultTo } from '../../../utils/rules/defaultTo/defaultTo.es6.js';
|
|
8
|
-
import { values } from '../../../utils/rules/values/values.es6.js';
|
|
8
|
+
import { values, getArrayValues } from '../../../utils/rules/values/values.es6.js';
|
|
9
9
|
import { minLength } from '../../../utils/rules/minLength/minLength.es6.js';
|
|
10
10
|
import { maxLength } from '../../../utils/rules/maxLength/maxLength.es6.js';
|
|
11
11
|
import { pattern } from '../../../utils/rules/pattern/pattern.es6.js';
|
|
@@ -27,7 +27,7 @@ const string = () => {
|
|
|
27
27
|
}
|
|
28
28
|
rules.push(String);
|
|
29
29
|
if (props.values) {
|
|
30
|
-
rules.push(values(props.values));
|
|
30
|
+
rules.push(values(getArrayValues(props.values)));
|
|
31
31
|
}
|
|
32
32
|
if (format !== undefined) {
|
|
33
33
|
schema.format = format;
|
|
@@ -5,7 +5,7 @@ import '../../../utils/index.es6.js';
|
|
|
5
5
|
import { useSchemaType } from '../../../hooks/useSchemaType/useSchemaType.es6.js';
|
|
6
6
|
import { defaultTo } from '../../../utils/rules/defaultTo/defaultTo.es6.js';
|
|
7
7
|
import { uuidTo } from '../../../utils/rules/uuidTo/uuidTo.es6.js';
|
|
8
|
-
import { values } from '../../../utils/rules/values/values.es6.js';
|
|
8
|
+
import { values, getArrayValues } from '../../../utils/rules/values/values.es6.js';
|
|
9
9
|
import { useRule } from '../../../hooks/useRule/useRule.es6.js';
|
|
10
10
|
import { optional } from '../../../utils/rules/optional/optional.es6.js';
|
|
11
11
|
import { pipe } from '../../../utils/rules/pipe/pipe.es6.js';
|
|
@@ -28,7 +28,7 @@ const uuid = () => {
|
|
|
28
28
|
}
|
|
29
29
|
rules.push(uuidTo);
|
|
30
30
|
if (props.values) {
|
|
31
|
-
rules.push(values(props.values));
|
|
31
|
+
rules.push(values(getArrayValues(props.values)));
|
|
32
32
|
}
|
|
33
33
|
if (defaultValue === undefined) {
|
|
34
34
|
useRule(optional(pipe(...rules)));
|
|
@@ -32,7 +32,7 @@ const uuid = () => {
|
|
|
32
32
|
}
|
|
33
33
|
rules.push(uuidTo.uuidTo);
|
|
34
34
|
if (props.values) {
|
|
35
|
-
rules.push(values.values(props.values));
|
|
35
|
+
rules.push(values.values(values.getArrayValues(props.values)));
|
|
36
36
|
}
|
|
37
37
|
if (defaultValue === undefined) {
|
|
38
38
|
useRule.useRule(optional.optional(pipe.pipe(...rules)));
|
package/types.d.ts
CHANGED
|
@@ -68,7 +68,8 @@ export interface BaseSchemaProps<T> {
|
|
|
68
68
|
title?: string;
|
|
69
69
|
writeOnly?: boolean;
|
|
70
70
|
}
|
|
71
|
+
export type SchemaValues<T> = (T extends (number | string) ? Record<T, string> : never) | T[];
|
|
71
72
|
export interface ValuesSchemaProps<T> extends BaseSchemaProps<T> {
|
|
72
73
|
const?: T;
|
|
73
|
-
values?: T
|
|
74
|
+
values?: SchemaValues<T>;
|
|
74
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { values } from './values.es6.js';
|
|
1
|
+
export { getArrayValues, values } from './values.es6.js';
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { type SchemaValues } from '../../../types';
|
|
2
|
+
export declare function getArrayValues<T, F extends (value: T | string) => any = () => T>(values: SchemaValues<T>, format?: F): ReturnType<F>[];
|
|
3
|
+
export declare function values<T>(values: T[]): (value: any, data?: object) => any;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { RulesError } from '../helpers.es6.js';
|
|
2
2
|
|
|
3
|
+
function getArrayValues(values, format = (value => value)) {
|
|
4
|
+
return Array.isArray(values) ? values.map(format) : Object.keys(values).map(format);
|
|
5
|
+
}
|
|
3
6
|
function values(values) {
|
|
4
7
|
return (value, data) => {
|
|
5
8
|
if (!values.includes(value)) {
|
|
@@ -13,4 +16,4 @@ function values(values) {
|
|
|
13
16
|
};
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
export { values };
|
|
19
|
+
export { getArrayValues, values };
|
|
@@ -4,6 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var helpers = require('../helpers.js');
|
|
6
6
|
|
|
7
|
+
function getArrayValues(values, format = (value => value)) {
|
|
8
|
+
return Array.isArray(values) ? values.map(format) : Object.keys(values).map(format);
|
|
9
|
+
}
|
|
7
10
|
function values(values) {
|
|
8
11
|
return (value, data) => {
|
|
9
12
|
if (!values.includes(value)) {
|
|
@@ -17,4 +20,5 @@ function values(values) {
|
|
|
17
20
|
};
|
|
18
21
|
}
|
|
19
22
|
|
|
23
|
+
exports.getArrayValues = getArrayValues;
|
|
20
24
|
exports.values = values;
|