node-mask-value
Mask the value of the object.
Install
% npm i @abetomo/mask-value
Examples
import { mask, masks, Config } from '@abetomo/mask-value'
type User = {
name: string
address: string
}
const data: User[] = [
{
name: 'name1',
address: 'address1'
},
{
name: 'name2',
address: 'address2'
}
]
const config: Config = {
path: '.[].name',
action: () => Math.random()
}
console.log(mask<User[]>(data, config))
const configs: Config[] = [
{
path: '.[].name',
action: () => Math.random()
},
{
path: '.[].address',
action: (s: string) => s.length * Math.random()
}
]
console.log(masks<User[]>(data, configs))