Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@abetomo/mask-value

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abetomo/mask-value

Mask the value of the object.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-87.5%
Maintainers
1
Weekly downloads
 
Created
Source

node-mask-value

npm version Test

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))
/*
Output:
[
  { name: 0.913236932864554, address: 'address1' },
  { name: 0.6970620876451457, address: 'address2' }
]
*/


const configs: Config[] = [
  {
    path: '.[].name',
    action: () => Math.random()
  },
  {
    path: '.[].address',
    action: (s: string) => s.length * Math.random()
  }
]

console.log(masks<User[]>(data, configs))
/*
Output:
[
  { name: 0.4253394097546368, address: 4.285149904757429 },
  { name: 0.7394228798993354, address: 6.334446902953465 }
]
*/

Keywords

FAQs

Package last updated on 29 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc