Sha256: aa360eb1e4a58352b294cebaf6d4f231a8a8dc8facd93458482c157ea46e90a6

Contents?: true

Size: 442 Bytes

Versions: 19

Compression:

Stored size: 442 Bytes

Contents

var makeString = require('./helper/makeString');
var toPositive = require('./helper/toPositive');

module.exports = function endsWith(str, ends, position) {
  str = makeString(str);
  ends = '' + ends;
  if (typeof position == 'undefined') {
    position = str.length - ends.length;
  } else {
    position = Math.min(toPositive(position), str.length) - ends.length;
  }
  return position >= 0 && str.indexOf(ends, position) === position;
};

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
ela-4.1.6 node_modules/underscore.string/endsWith.js
ela-4.1.5 node_modules/underscore.string/endsWith.js
ela-4.1.4 node_modules/underscore.string/endsWith.js
ela-4.1.3 node_modules/underscore.string/endsWith.js
ela-4.1.2 node_modules/underscore.string/endsWith.js
ela-4.1.1 node_modules/underscore.string/endsWith.js
ela-4.1.0 node_modules/underscore.string/endsWith.js
ela-4.0.0 node_modules/underscore.string/endsWith.js
ela-3.4.3 node_modules/underscore.string/endsWith.js
ela-3.4.2 node_modules/underscore.string/endsWith.js
ela-3.4.0 node_modules/underscore.string/endsWith.js
ela-3.3.1 node_modules/underscore.string/endsWith.js
ela-3.3.0 node_modules/underscore.string/endsWith.js
ela-3.2.0 node_modules/underscore.string/endsWith.js
ela-3.1.1 node_modules/underscore.string/endsWith.js
ela-3.1.0 node_modules/underscore.string/endsWith.js
ela-3.0.0 node_modules/underscore.string/endsWith.js
ela-2.0.0 node_modules/underscore.string/endsWith.js
ela-1.1.0 node_modules/underscore.string/endsWith.js