Sha256: 7059f4408ea6d4de225b9f0f53ac91f299b1a14d58e5aa50c9cd5893c5d5ac84
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
/* * should.js - assertion library * Copyright(c) 2010-2013 TJ Holowaychuk <tj@vision-media.ca> * Copyright(c) 2013-2016 Denis Bardadym <bardadymchik@gmail.com> * MIT Licensed */ var util = require('../util'); var assert = require('./_assert'); var AssertionError = require('../assertion-error'); module.exports = function(should) { var i = should.format; /* * Expose assert to should * * This allows you to do things like below * without require()ing the assert module. * * should.equal(foo.bar, undefined); * */ util.merge(should, assert); /** * Assert _obj_ exists, with optional message. * * @static * @memberOf should * @category assertion assert * @alias should.exists * @param {*} obj * @param {String} [msg] * @example * * should.exist(1); * should.exist(new Date()); */ should.exist = should.exists = function(obj, msg) { if (null == obj) { throw new AssertionError({ message: msg || ('expected ' + i(obj) + ' to exist'), stackStartFunction: should.exist }); } }; should.not = {}; /** * Asserts _obj_ does not exist, with optional message. * * @name not.exist * @static * @memberOf should * @category assertion assert * @alias should.not.exists * @param {*} obj * @param {String} [msg] * @example * * should.not.exist(null); * should.not.exist(void 0); */ should.not.exist = should.not.exists = function(obj, msg) { if (null != obj) { throw new AssertionError({ message: msg || ('expected ' + i(obj) + ' to not exist'), stackStartFunction: should.not.exist }); } }; };
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stylus-source-0.54.5 | vendor/node_modules/should/lib/ext/assert.js |