JSPM

  • Created
  • Published
  • Downloads 55178
  • Score
    100M100P100Q151182F
  • License MIT

Test helper to generate function opts object variations

Package Exports

  • test-mixer

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 (test-mixer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

test-mixer

Test helper to generate function opts object variations

Install

npm i test-mixer

Quick Take

import { strict as assert } from "assert";
import mixer from "test-mixer";

// generates 2^n combinations
assert.deepEqual(
  mixer(
    {
      foo: true, // override
      baz: 1, // not a boolean
    },
    {
      // defaults or reference object:
      foo: true,
      bar: false,
      baz: 0, // default is not a boolean either
    }
  ),
  [
    {
      foo: true, // static, as per 1st arg
      bar: false, // combination #1
      baz: 1, // non-bools get copied over
    },
    {
      foo: true, // static, as per 1st arg
      bar: true, // combination #2
      baz: 1, // non-bools get copied over
    },
  ]
);

Documentation

Please visit codsen.com for a full description of the API and examples.

Licence

MIT License

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

ok codsen star