@abetomo/mask-value
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    node-mask-value

    npm version

    Mask the value of the object.

    Install

    % npm i @abetomo/mask-value
    

    Examples

    import { mask, masks } from '@abetomo/mask-value'
     
    const data = [
      {
        name: 'name1',
        address: 'address1'
      },
      {
        name: 'name2',
        address: 'address2'
      }
    ]
     
    const config = {
      path: '.[].name',
      action: () => Math.random()
    }
     
    console.log(mask(data, config))
    /*
    Output:
    [
      { name: 0.913236932864554, address: 'address1' },
      { name: 0.6970620876451457, address: 'address2' }
    ]
    */
     
     
    const configs = [
      config,
      {
        path: '.[].address',
        action: (s: string) => s.length * Math.random()
      }
    ]
     
    console.log(masks(data, configs))
    /*
    Output:
    [
      { name: 0.4253394097546368, address: 4.285149904757429 },
      { name: 0.7394228798993354, address: 6.334446902953465 }
    ]
    */

    Keywords

    Install

    npm i @abetomo/mask-value

    DownloadsWeekly Downloads

    2

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    5.78 kB

    Total Files

    5

    Last publish

    Collaborators

    • abetomo