map-transform 0.4.0-alpha.15 → 0.4.0-alpha.16
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 +3 -0
- package/dist/operations/apply.js +1 -4
- package/dist/operations/apply.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -645,6 +645,9 @@ When an id is passed to the apply operation as `pipelinedId`, the pipeline will
|
|
|
645
645
|
be applied in the place of the apply operation and executed as if it was part of
|
|
646
646
|
the pipeline definition in the first place.
|
|
647
647
|
|
|
648
|
+
When no pipeline is provided, e.g. because the id is unknown, no pipeline will
|
|
649
|
+
be applied and the data will pass through untouched.
|
|
650
|
+
|
|
648
651
|
```javascript
|
|
649
652
|
import { mapTransform, apply, transform } from 'map-transform'
|
|
650
653
|
|
package/dist/operations/apply.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const definitionHelpers_1 = require("../utils/definitionHelpers");
|
|
4
|
-
const stateHelpers_1 = require("../utils/stateHelpers");
|
|
5
4
|
const extractPipeline = (pipelineId, { pipelines }) => pipelineId && pipelines ? pipelines[pipelineId] : undefined;
|
|
6
5
|
function apply(pipelineId) {
|
|
7
6
|
return (options) => {
|
|
8
7
|
const pipeline = extractPipeline(pipelineId, options);
|
|
9
|
-
return pipeline
|
|
10
|
-
? (0, definitionHelpers_1.mapFunctionFromDef)(pipeline)(options)
|
|
11
|
-
: (state) => (0, stateHelpers_1.setStateValue)(state, undefined);
|
|
8
|
+
return pipeline ? (0, definitionHelpers_1.mapFunctionFromDef)(pipeline)(options) : (state) => state;
|
|
12
9
|
};
|
|
13
10
|
}
|
|
14
11
|
exports.default = apply;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/operations/apply.ts"],"names":[],"mappings":";;AACA,kEAA+D;
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/operations/apply.ts"],"names":[],"mappings":";;AACA,kEAA+D;AAE/D,MAAM,eAAe,GAAG,CAAC,UAAkB,EAAE,EAAE,SAAS,EAAW,EAAE,EAAE,CACrE,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAE7D,SAAwB,KAAK,CAAC,UAAkB;IAC9C,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,MAAM,QAAQ,GAAG,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QACrD,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAA,sCAAkB,EAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAA;IAC5E,CAAC,CAAA;AACH,CAAC;AALD,wBAKC"}
|
package/package.json
CHANGED