Sha256: be88c3b3a1fdd6edd35a395352ba24cec1d5720a44580533cb1c97daa2e330a8
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 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 */ module.exports = function(should, Assertion) { /** * Assert given string starts with prefix * @name startWith * @memberOf Assertion * @category assertion strings * @param {string} str Prefix * @param {string} [description] Optional message * @example * * 'abc'.should.startWith('a'); */ Assertion.add('startWith', function(str, description) { this.params = { operator: 'to start with ' + should.format(str), message: description }; this.assert(0 === this.obj.indexOf(str)); }); /** * Assert given string ends with prefix * @name endWith * @memberOf Assertion * @category assertion strings * @param {string} str Prefix * @param {string} [description] Optional message * @example * * 'abca'.should.endWith('a'); */ Assertion.add('endWith', function(str, description) { this.params = { operator: 'to end with ' + should.format(str), message: description }; this.assert(this.obj.indexOf(str, this.obj.length - str.length) >= 0); }); };
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stylus-source-0.54.5 | vendor/node_modules/should/lib/ext/string.js |