makeCustomizableData
The `makeCustomizableData` function allows you to execute a series of transformations on an objet.
makeCustomizableData function
Params
| Name | Type | Description |
|---|---|---|
initialTransforms | any[] | Array of transform functions |
Return
It returns a new object with the registerTransform and makeData functions:
| Type | Description |
|---|---|
registerTransform | A method to allow to register new transformations |
makeData | Apply all transformations to a variable |
Example
import { makeCustomizableData } from "@front-commerce/core/graphql";
const transformer = (data) => {
// Do your transformation
return data;
};
const customData = makeCustomizableData([transformer]);
registerTransform
Add a transform function
Params
| Name | Type | Description |
|---|---|---|
transform | function | The transform function |
Return
Nothing
Example
import { makeCustomizableData } from "@front-commerce/core/graphql";
const customData = makeCustomizableData();
const transformer = (data) => {
// Do your transformation
return data;
};
customData.registerTransform(transformer);
makeData
Apply all transformations to a variable