开发者社区> 镜像站> NPM> truffle-conflux-expect
truffle-conflux-expect
Simple module for ensuring specific options are passed to a function
Last updated a year ago by liuis .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install truffle-conflux-expect 
SYNC missed versions from official npm registry.

truffle-conflux-expect

Simple module for ensuring expected parameters exist

install

$ npm install truffle-conflux-expect

Usage

const expect = require("truffle-conflux-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

Current Tags

  • 0.0.2-alpha.0                                ...           latest (a year ago)

1 Versions

  • 0.0.2-alpha.0                                ...           a year ago