1.0.0 • Published 7 years ago

@tiaanduplessis/freezo v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

Install

$ npm install freezo
# OR
$ yarn add freezo

Usage

import { freeze, thaw } from 'freezo'

const frozenArr = freeze([1, 2, 3, { foo: 1, bar: 2 }, 5])
const frozenObj = freeze({ foo: 1, bar: 2, baz: { foo: 1, bar: 2 } })

console.log(Object.isFrozen(frozenArr)) // true
console.log(Object.isFrozen(frozenArr[3])) // true
console.log(Object.isFrozen(frozenObj)) // true
console.log(Object.isFrozen(frozenObj.baz)) // true

const unfrozenArr = thaw(frozenArr)
const unfrozenObj = thaw(frozenObj)

console.log(Object.isFrozen(unfrozenArr)) // false
console.log(Object.isFrozen(unfrozenArr[3])) // false
console.log(Object.isFrozen(unfrozenObj)) // false
console.log(Object.isFrozen(unfrozenObj.baz)) // false

Contributing

Contributions are welcome!

  1. Fork it.
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Or open up a issue.

License

Licensed under the MIT License.

1.0.0

7 years ago