object-all-values-equal-to
v4.0.18
Published
Does the AST/nested-plain-object/array/whatever contain only one kind of value?
Downloads
667
Maintainers
Readme
Install
This package is pure ESM. If you're not ready yet, install an older version of this program, 2.1.0 (npm i [email protected]
).
npm i object-all-values-equal-to
Quick Take
import { strict as assert } from "assert";
import { allEq } from "object-all-values-equal-to";
// are all values equal to null:
assert.equal(allEq({ a: null, c: null }, null), true);
// yes
// are all values equal to "false":
assert.equal(allEq({ a: false, c: "zzz" }, false), false);
// no
// are all values equal to "false"?
assert.equal(
allEq(
{
a: {
b: false,
c: [
{
d: false,
e: false,
},
{
g: false,
},
],
},
c: false,
},
false, // reference value to check
),
true, // answer is, yes
);
Documentation
Please visit codsen.com for a full description of the API.
Contributing
To report bugs or request features or assistance, raise an issue on GitHub.
Licence
MIT License.
Copyright © 2010-2024 Roy Revelt and other contributors.