map-transform 1.3.0 → 1.5.0
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/README.md +22 -3
- package/dist/transformers/bucket.d.ts +1 -0
- package/dist/transformers/bucket.js +28 -11
- package/dist/transformers/bucket.js.map +1 -1
- package/dist/transformers/project.d.ts +2 -0
- package/dist/transformers/project.js +39 -7
- package/dist/transformers/project.js.map +1 -1
- package/dist/utils/escape.d.ts +1 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1425,11 +1425,14 @@ The following transformers may be applied to the value in a pipeline with the
|
|
|
1425
1425
|
with the [`filter` operation](#filterconditionFn-operation) to filter away
|
|
1426
1426
|
values in the pipeline.
|
|
1427
1427
|
|
|
1428
|
-
#### `bucket({ path, buckets })` transformer
|
|
1428
|
+
#### `bucket({ path, buckets, groupByPath })` transformer
|
|
1429
1429
|
|
|
1430
1430
|
The `bucket` transformer will split an array out in buckets based on condition
|
|
1431
1431
|
pipelines (pipelines that will return truthy for the items that belong in
|
|
1432
1432
|
a certain bucket) or by size (how many items from the array to put in a bucket).
|
|
1433
|
+
There's also an alternative way of using `groupByPath` (see below).
|
|
1434
|
+
|
|
1435
|
+
You may specify a `path` to the array that will be sorted into buckets.
|
|
1433
1436
|
|
|
1434
1437
|
The buckets are defined in an array on the `buckets` property, with one object
|
|
1435
1438
|
per bucket. The object has a `key` property that will be the key of the bucket
|
|
@@ -1439,13 +1442,23 @@ belong in the bucket. When distributing based on size, you set `size` to the
|
|
|
1439
1442
|
number of items you want to put in this bucket. You may also combine `condition`
|
|
1440
1443
|
and `size`, to get the provided number of items matching the condition.
|
|
1441
1444
|
|
|
1442
|
-
You may also specify a `path` to the array that will be sorted into buckets.
|
|
1443
|
-
|
|
1444
1445
|
Each item is tested against the bucket condition in the order the buckets are
|
|
1445
1446
|
defined, and will be placed in the first bucket that matches. You may have
|
|
1446
1447
|
a bucket without a condition or size, which will serve as a catch-all bucket,
|
|
1447
1448
|
and should therefore be placed last.
|
|
1448
1449
|
|
|
1450
|
+
As an alternative to specifying `buckets`, you may provide a path or a pipeline
|
|
1451
|
+
in `groupByPath`. The transformer will then fetch the value from that path or
|
|
1452
|
+
pipeline for every item in the array, and use it as keys for buckets. Every item
|
|
1453
|
+
with the same value returned from `groupByPath` will be grouped together. You
|
|
1454
|
+
may for example set `groupByPath: 'category'` to get an object with all
|
|
1455
|
+
available categories as keys, and items with a certain category grouped in an
|
|
1456
|
+
array on the category property.
|
|
1457
|
+
|
|
1458
|
+
The value returned from the `groupByPath` pipeline will be forced to a string.
|
|
1459
|
+
When the value from an item is a non-value, the item will not be put in any
|
|
1460
|
+
group.
|
|
1461
|
+
|
|
1449
1462
|
When a bucket is run in reverse, the items in the buckets will be merged into
|
|
1450
1463
|
one array. The order of the items will be the same as the order of the buckets
|
|
1451
1464
|
and not the order of the items in the original array. When a path is given, the
|
|
@@ -1855,6 +1868,12 @@ props in `exclude`. Both `include` and `exclude` may be array of strings, and
|
|
|
1855
1868
|
they should not be used in combination. If both are provided, `include` will be
|
|
1856
1869
|
used.
|
|
1857
1870
|
|
|
1871
|
+
You may also specify an `includePath` or `excludePath`. These are dot notation
|
|
1872
|
+
paths to arrays of strings, and will be used instead of `include` or `exclude`.
|
|
1873
|
+
If `include` or `exclude` are also provided, they will be used as default
|
|
1874
|
+
values when the corresponding path yields no value. Note that "no value" here
|
|
1875
|
+
means `undefined`, and we don't support custom nonvalues here yet.
|
|
1876
|
+
|
|
1858
1877
|
When given an array of object, each object will be projected. When given
|
|
1859
1878
|
anything that is not an object, undefined will be returned.
|
|
1860
1879
|
|
|
@@ -12,15 +12,25 @@ function addToBucket(value, buckets, key) {
|
|
|
12
12
|
buckets.set(key, [value]);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
async function sortIntoBuckets(getFn, pipelines, data, state) {
|
|
15
|
+
async function sortIntoBuckets(getFn, pipelines, getGroupFn, data, state, nonvalues) {
|
|
16
16
|
const arr = ensureArray(getFn(data, state));
|
|
17
17
|
const retBucket = new Map();
|
|
18
|
-
|
|
19
|
-
for (const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
if (pipelines.length > 0) {
|
|
19
|
+
for (const value of arr) {
|
|
20
|
+
for (const [pipeline, key] of pipelines) {
|
|
21
|
+
const result = await pipeline(value, state);
|
|
22
|
+
if (result) {
|
|
23
|
+
addToBucket(value, retBucket, key);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else if (getGroupFn) {
|
|
30
|
+
for (const value of arr) {
|
|
31
|
+
const key = await getGroupFn(value, state);
|
|
32
|
+
if (!isNonvalue(key, nonvalues)) {
|
|
33
|
+
addToBucket(value, retBucket, String(key));
|
|
24
34
|
}
|
|
25
35
|
}
|
|
26
36
|
}
|
|
@@ -40,27 +50,34 @@ function shouldGoInBucket(options, condition, size) {
|
|
|
40
50
|
};
|
|
41
51
|
}
|
|
42
52
|
const extractArrayFromBuckets = (buckets, keys, nonvalues) => isObject(buckets)
|
|
43
|
-
? keys
|
|
53
|
+
? (keys || Object.keys(buckets))
|
|
44
54
|
.flatMap((key) => buckets[key])
|
|
45
55
|
.filter((key) => !isNonvalue(key, nonvalues))
|
|
46
56
|
: [];
|
|
47
|
-
const
|
|
57
|
+
const prepareGroupByPathFn = (pipeline, options) => typeof pipeline === 'string'
|
|
58
|
+
? pathGetter(pipeline)
|
|
59
|
+
: pipeline === undefined
|
|
60
|
+
? undefined
|
|
61
|
+
: defToDataMapper(pipeline, options);
|
|
62
|
+
const extractBucketKeys = (buckets, hasGroupFn) => buckets.length === 0 && hasGroupFn ? undefined : buckets.map(({ key }) => key);
|
|
63
|
+
const transformer = function bucket({ path = '.', buckets = [], groupByPath, }) {
|
|
48
64
|
return (options) => {
|
|
49
65
|
const getFn = pathGetter(path);
|
|
50
66
|
const setFn = pathSetter(path, options);
|
|
67
|
+
const getGroupByPathFn = prepareGroupByPathFn(groupByPath, options);
|
|
51
68
|
const pipelines = buckets
|
|
52
69
|
.filter(({ key }) => typeof key === 'string')
|
|
53
70
|
.map((bucket) => [
|
|
54
71
|
shouldGoInBucket(options, bucket.condition ?? bucket.pipeline, bucket.size),
|
|
55
72
|
bucket.key,
|
|
56
73
|
]);
|
|
57
|
-
const keys = buckets
|
|
74
|
+
const keys = extractBucketKeys(buckets, !!getGroupByPathFn);
|
|
58
75
|
return async (data, state) => {
|
|
59
76
|
if (revFromState(state)) {
|
|
60
77
|
return setFn(extractArrayFromBuckets(data, keys, options.nonvalues), state);
|
|
61
78
|
}
|
|
62
79
|
else {
|
|
63
|
-
return sortIntoBuckets(getFn, pipelines, data, state);
|
|
80
|
+
return sortIntoBuckets(getFn, pipelines, getGroupByPathFn, data, state, options.nonvalues);
|
|
64
81
|
}
|
|
65
82
|
};
|
|
66
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bucket.js","sourceRoot":"","sources":["../../src/transformers/bucket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"bucket.js","sourceRoot":"","sources":["../../src/transformers/bucket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,EAAE,WAAW,EAAE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,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;gBACxB,OAAO,KAAK,CACV,uBAAuB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,EACtD,KAAK,CACN,CAAA;YACH,CAAC;iBAAM,CAAC;gBACN,OAAO,eAAe,CACpB,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,IAAI,EACJ,KAAK,EACL,OAAO,CAAC,SAAS,CAClB,CAAA;YACH,CAAC;QACH,CAAC,CAAA;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Transformer, TransformerProps } from '../types.js';
|
|
2
2
|
export interface Props extends TransformerProps {
|
|
3
3
|
include?: string[];
|
|
4
|
+
includePath?: string;
|
|
4
5
|
exclude?: string[];
|
|
6
|
+
excludePath?: string;
|
|
5
7
|
}
|
|
6
8
|
declare const transformer: Transformer<Props>;
|
|
7
9
|
export default transformer;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import mapAny from 'map-any';
|
|
2
|
+
import { pathGetter } from '../operations/getSet.js';
|
|
2
3
|
import { isObject, isString, isNonEmptyArray } from '../utils/is.js';
|
|
4
|
+
import { ensureArray } from '../utils/array.js';
|
|
3
5
|
const projectProps = (rawProps, doInclude) => {
|
|
4
6
|
const props = rawProps.filter(isString);
|
|
5
7
|
const filterFn = doInclude
|
|
@@ -7,13 +9,43 @@ const projectProps = (rawProps, doInclude) => {
|
|
|
7
9
|
: ([key]) => !props.includes(key);
|
|
8
10
|
return (obj) => Object.fromEntries(Object.entries(obj).filter(filterFn));
|
|
9
11
|
};
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
const projectPropsFromPath = (path, rawProps, doInclude) => {
|
|
13
|
+
const getFn = pathGetter(path);
|
|
14
|
+
return (obj, state) => {
|
|
15
|
+
let props = getFn(obj, state);
|
|
16
|
+
if (props === undefined) {
|
|
17
|
+
props = rawProps;
|
|
18
|
+
}
|
|
19
|
+
if (!props) {
|
|
20
|
+
return obj;
|
|
21
|
+
}
|
|
22
|
+
return projectProps(ensureArray(props), doInclude)(obj);
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
function prepareProjectFn(include, includePath, exclude, excludePath) {
|
|
26
|
+
if (typeof includePath === 'string') {
|
|
27
|
+
return projectPropsFromPath(includePath, include, true);
|
|
28
|
+
}
|
|
29
|
+
else if (typeof excludePath === 'string') {
|
|
30
|
+
return projectPropsFromPath(excludePath, exclude, false);
|
|
31
|
+
}
|
|
32
|
+
else if (isNonEmptyArray(include)) {
|
|
33
|
+
return projectProps(include, true);
|
|
34
|
+
}
|
|
35
|
+
else if (isNonEmptyArray(exclude)) {
|
|
36
|
+
return projectProps(exclude, false);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return (obj) => obj;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const transformer = function bucket({ include, includePath, exclude, excludePath, }) {
|
|
43
|
+
const projectFn = prepareProjectFn(include, includePath, exclude, excludePath);
|
|
44
|
+
return () => (data, state) => mapAny((data) => isObject(data)
|
|
45
|
+
? state.rev
|
|
46
|
+
? data
|
|
47
|
+
: projectFn(data, state)
|
|
48
|
+
: undefined, data);
|
|
17
49
|
};
|
|
18
50
|
export default transformer;
|
|
19
51
|
//# sourceMappingURL=project.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/transformers/project.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/transformers/project.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,M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ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const escapeValue: <T = unknown>(value:
|
|
1
|
+
export declare const escapeValue: <T = unknown>(value: T | string) => string | (T & ({} | null));
|
|
2
2
|
export declare const unescapeValue: <T = unknown>(value: T | undefined) => T | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "map-transform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Map and transform objects with mapping definitions",
|
|
5
5
|
"author": "Kjell-Morten Bratsberg Thorsen <kjellmorten@integreat.io>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
|
-
"test": "npm run build && c8 --reporter=text-summary ava --config ./ava-dist.config.
|
|
29
|
+
"test": "npm run build && c8 --reporter=text-summary ava --config ./ava-dist.config.js",
|
|
30
30
|
"test:watch": "npm run dev",
|
|
31
31
|
"dev": "ava --watch",
|
|
32
|
-
"perf": "ava --watch --config ./ava-perf.config.
|
|
32
|
+
"perf": "ava --watch --config ./ava-perf.config.js",
|
|
33
33
|
"build": "tsc",
|
|
34
34
|
"prepublish": "npm run build",
|
|
35
35
|
"coverage": "c8 report",
|
|
@@ -53,9 +53,10 @@
|
|
|
53
53
|
"map-any": "^1.0.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@integreat/ts-dev-setup": "^
|
|
56
|
+
"@integreat/ts-dev-setup": "^6.0.1",
|
|
57
57
|
"@types/deep-freeze": "^0.1.5",
|
|
58
|
-
"@types/
|
|
58
|
+
"@types/node": "^20.11.27",
|
|
59
|
+
"@types/sinon": "^17.0.3",
|
|
59
60
|
"deep-freeze": "0.0.1",
|
|
60
61
|
"sinon": "^17.0.1"
|
|
61
62
|
}
|