npm.io
0.6.1 • Published 8 years ago

picklock

Licence
MIT
Version
0.6.1
Deps
0
Vulns
0
Weekly
0

Picklock

The picklock practically for any situation - collection of usefull tools

travis-web total downloads

Here you can read some documentation.

Installing

yarn add picklock --dev

or

npm i picklock -D

Usage example

import { addProperty, deleteProperty } from 'picklock';

const Snow = {
  name: 'John',
  age: 20,
  role: 'Bastard',
}

const Stark = deleteProperty(Snow, 'role');

console.log(Stark) // => { name: 'John', age: 20 }
console.log(Snow) // => { name: 'John', age: 20, role: 'Bastard' }
console.log(addProperty(Snow, 'father', 'Eddard')) // => { name: 'John', age: 20, role: 'Bastard', father: 'Eddard' }
console.log(addProperty(Snow, 'name', 'Ramsay')) // => Error: Property 'name' already exists in target Object!

Keywords