JSPM

default-opts

0.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q28441F
  • License MIT

Set defaults for options

Package Exports

  • default-opts

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

Readme

default-opts Build Status

Set default values for opts.

Functions

Please note that this is directly from test/basic.js

var test = require('tape');
var defOpts = require('default-opts');

var opts = {"boolean":true,"number":123,"string":"Hello World"};
var defaults = {"boolean":false,"number":321,"string":"Goodbye World","default":"default"};

test('sync', function(t) {
    t.plan(1);
    var syncResult = defOpts.optsSync(opts, defaults);
    t.equal(syncResult, {"boolean":true,"number":123,"string":"Hello World","default":"default"});
});

test('async', function(t) {
    t.plan(1);
    defOpts.opts(opts, defaults, function(err, result) {
        t.equal(result, {"boolean":true,"number":123,"string":"Hello World","default":"default"});
});

test('promise', function(t) {
    t.plan(1);
    defOpts.opts(opts, defaults).then(function(result) {
        t.equal(result, {"boolean":true,"number":123,"string":"Hello World","default":"default"});
    });
});

License

MIT