UNPKG

hamjest

Version:

A library of composable matchers for defining meaningful and readable assertions in JavaScript.

27 lines (21 loc) 496 B
'use strict'; const _ = require('lodash'); const Matcher = require('./Matcher'); const not = require('./IsNot').not; function IsDefined() { return _.create(new Matcher(), { matches: function (actual) { return !_.isUndefined(actual); }, describeTo: function (description) { description.append('defined'); } }); } IsDefined.defined = function () { return new IsDefined(); }; IsDefined.undefined = function () { return not(IsDefined.defined()); }; module.exports = IsDefined;