JSPM

  • Created
  • Published
  • Downloads 117
  • Score
    100M100P100Q84080F
  • License MIT

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

Package Exports

  • object-all-values-equal-to

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (object-all-values-equal-to) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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