UNPKG

@nlighten/json-transform-core

Version:

Core types and utilities for handling JSON transformers

59 lines (58 loc) 1.43 kB
[ { "name": "object - transformation with item lookup", "given": { "input": { "value": 5, "item": { "foo": "aaa", "id": "bbb" } }, "definition": { "$$transform": "$.item", "to": { "id": "##current.id", "map_foo": "##current.foo", "value": "$.value" } } }, "expect": { "equal": { "id": "bbb", "map_foo": "aaa", "value": 5 } } }, { "name": "object - transformation with split function", "given": { "input": "a,b", "definition": { "$$transform": "$$split(','):$", "to": { "left": "##current[0]", "right": "##current[1]" } } }, "expect": { "equal": { "left": "a", "right": "b" } } }, { "name": "inline - transformation with split function", "given": { "input": "ab", "definition": "$$transform(##current[0]):$$split:$" }, "expect": { "equal": "a" } } ]