Skip to content

Target has no effect on hydration #148

Description

@edgylord

Using:
map-transform@1.5.4

const source = {
	data: [
		{
			content: {
				name: 'An interesting piece',
				meta: {
					author: 'fredj',
					date: 1533750490952
				}
			}
		}
	]
}

const def = [
	'data[0].content',
	{
		title: 'name',
		author: 'meta.author',
	},
]

//docs: provide MapTransform with a target that the transformation will be applied to
const target = { id: '12345', title: 'Default title' }
const result = await mapTransform(def)(source, { target })

//expect:
//{
//  id: '12345',
//  title: 'An interesting piece',
//  author: 'fredj',
//}

//returns (=> no id field):
//{
//  title: 'An interesting piece',
//  author: 'fredj',
//}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions