blueflag-record
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -183,2 +183,7 @@ "use strict"; | ||
}); | ||
it('allows falsey values to be got', function () { | ||
expect(new FooRecord({ | ||
baz: false | ||
}).baz).toBe(false); | ||
}); | ||
it('applies getter to the value', function () { | ||
@@ -304,2 +309,10 @@ var date = new DateRecord({ | ||
}); | ||
}); | ||
describe('printing to console', function () { | ||
it('it will return a string of record contents when inspect() is called', function () { | ||
var foo = new FooRecord({ | ||
foo: 1 | ||
}); | ||
expect(foo.inspect()).toBe('Record {\n "foo": 1\n}'); | ||
}); | ||
}); |
@@ -18,2 +18,4 @@ "use strict"; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); | ||
@@ -75,2 +77,5 @@ | ||
(0, _classCallCheck2.default)(this, Record); | ||
(0, _defineProperty2.default)(this, "inspect", function () { | ||
return "Record ".concat(JSON.stringify(_this.toObject(), null, 2)); | ||
}); | ||
@@ -104,3 +109,5 @@ var setter = function setter(key, value) { | ||
get: nonEnumerable(function (key, notFoundValue) { | ||
return getter(key, _this._data[key] || notFoundValue || _this._notSetValues[key]); | ||
notFoundValue = notFoundValue !== undefined ? notFoundValue : _this._notSetValues[key]; | ||
var value = (0, _get.default)(key, notFoundValue)(_this._data); | ||
return getter(key, value); | ||
}), | ||
@@ -174,3 +181,4 @@ getIn: nonEnumerable(function (path, notFoundValue) { | ||
}); | ||
} | ||
} // for printing records with console.log() in node | ||
}]); | ||
@@ -177,0 +185,0 @@ return Record; |
{ | ||
"main": "lib/index.js", | ||
"name": "blueflag-record", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "An Unmutable compatible record", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
18455
451
0