Neutrinos Peludos Magnéticos
Wondering what’s next for npm?Check out our public roadmap! »

object-all-values-equal-to
TypeScript icon, indicating that this package has built-in type declarations

2.0.6 • Public • Published

object-all-values-equal-to

Does the AST/nested-plain-object/array/whatever contain only one kind of value?

Install

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 and examples.

Contributing

To report bugs or request features or assistance, raise an issue on GitHub.

Licence

MIT License

Copyright (c) 2010-2021 Roy Revelt and other contributors

ok codsen star

Install

npm i object-all-values-equal-to

DownloadsWeekly Downloads

312

Version

2.0.6

License

MIT

Unpacked Size

92.6 kB

Total Files

12

Last publish

Collaborators

  • avatar