Skip to content

Commit

Permalink
Added freeze
Browse files Browse the repository at this point in the history
  • Loading branch information
ncthbrt committed Jan 17, 2018
1 parent 9365e65 commit 00e78ec
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
11 changes: 11 additions & 0 deletions lib/freeze.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const not = (f) => (x) => !f(x);
const freeze = (object) => {
Object.freeze(object);
Object.getOwnPropertyNames(object || {})
.map(name => object[name])
.filter(not(Object.isFrozen))
.forEach(freeze);
return object;
};

module.exports = freeze;
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"url": "http://github.com/ncthbrt/nact/issues"
},
"dependencies": {
"deep-freeze-node": "^1.1.3",
"denque": "^1.2.2",
"rxjs": "^5.4.3"
},
Expand All @@ -52,4 +51,4 @@
"sinon": "^4.1.4",
"sinon-chai": "^2.14.0"
}
}
}
4 changes: 0 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,6 @@ deep-eql@^2.0.1:
dependencies:
type-detect "^3.0.0"

deep-freeze-node@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/deep-freeze-node/-/deep-freeze-node-1.1.3.tgz#ce9c14b3210e6f5607a578254f4b53fe01dd9467"

deep-is@~0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
Expand Down

0 comments on commit 00e78ec

Please sign in to comment.