JSPM

  • Created
  • Published
  • Downloads 6945
  • Score
    100M100P100Q9143F
  • License MIT

Simple module for ensuring specific options are passed to a function

Package Exports

  • @truffle/expect

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

Readme

@truffle/expect

Simple module for ensuring expected parameters exist

install

$ npm install @truffle/expect

Usage

const expect = require("@truffle/expect");

// the object you're testing
const options = {
  example: "exists",
  another: 5
};

expect.options(options, ["example", "another"]); // does nothing because both key values exist
expect.options(options, ["example", "another", "some_other_key"]); // errors because options["some_other_key"] is undefined

expect.one(options, ["example", "optional_key"]); // does nothing because at least one key value exists
expect.one(options, ["optional_key", "other_optional_key"]); // errors because both key values are undefined