Skip to content

Commit

Permalink
v4.0.2. Fixed bug when trying to gawk process.env.
Browse files Browse the repository at this point in the history
  • Loading branch information
cb1kenobi committed Apr 8, 2017
1 parent c55e2af commit 0bfadd5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gawk",
"version": "4.0.1",
"version": "4.0.2",
"description": "Observable JavaScript object model",
"main": "./dist/index.js",
"author": "Chris Barber <[email protected]> (https://github.com/cb1kenobi)",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default function gawk(value, parent) {
}

// only objects can be gawked
if (!value || typeof value !== 'object') {
if (!value || typeof value !== 'object' || value === process.env) {
return value;
}

Expand Down
11 changes: 11 additions & 0 deletions test/test-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ describe('gawk() object', () => {
expect(gobj).to.not.equal(emitter);
});

it('should not gawk process.env', () => {
const gobj = gawk(process.env);
expect(gobj).not.to.have.property('__gawk__');
expect(isGawked(gobj)).to.be.false;
});

it('should gawk clone of process.env', () => {
const gobj = gawk(Object.assign({}, process.env));
expect(isGawked(gobj)).to.be.true;
});

it('should not allow __gawk__ to be set', () => {
const gobj = gawk({});
expect(isGawked(gobj)).to.be.true;
Expand Down

0 comments on commit 0bfadd5

Please sign in to comment.