Sha256: e7b9b316913e7080015e81258958856f6e7b72ed83b50169ecadfff203ca6f94

Contents?: true

Size: 1.07 KB

Versions: 276

Compression:

Stored size: 1.07 KB

Contents

var baseClamp = require('./_baseClamp'),
    baseToString = require('./_baseToString'),
    toInteger = require('./toInteger'),
    toString = require('./toString');

/**
 * Checks if `string` ends with the given target string.
 *
 * @static
 * @memberOf _
 * @since 3.0.0
 * @category String
 * @param {string} [string=''] The string to inspect.
 * @param {string} [target] The string to search for.
 * @param {number} [position=string.length] The position to search up to.
 * @returns {boolean} Returns `true` if `string` ends with `target`,
 *  else `false`.
 * @example
 *
 * _.endsWith('abc', 'c');
 * // => true
 *
 * _.endsWith('abc', 'b');
 * // => false
 *
 * _.endsWith('abc', 'b', 2);
 * // => true
 */
function endsWith(string, target, position) {
  string = toString(string);
  target = baseToString(target);

  var length = string.length;
  position = position === undefined
    ? length
    : baseClamp(toInteger(position), 0, length);

  var end = position;
  position -= target.length;
  return position >= 0 && string.slice(position, end) == target;
}

module.exports = endsWith;

Version data entries

276 entries across 274 versions & 31 rubygems

Version Path
rapid_stack-0.1.1 templates/FrontEnd/node_modules/lodash/endsWith.js
rapid_stack-0.1.0 templates/FrontEnd/node_modules/lodash/endsWith.js
immosquare-cleaner-0.1.60 node_modules/lodash/endsWith.js
immosquare-cleaner-0.1.59 node_modules/lodash/endsWith.js
immosquare-cleaner-0.1.58 node_modules/lodash/endsWith.js
immosquare-cleaner-0.1.57 node_modules/lodash/endsWith.js
immosquare-cleaner-0.1.56 node_modules/lodash/endsWith.js
immosquare-cleaner-0.1.55 node_modules/lodash/endsWith.js
immosquare-cleaner-0.1.54 node_modules/lodash/endsWith.js
immosquare-cleaner-0.1.53 node_modules/lodash/endsWith.js
immosquare-cleaner-0.1.52 node_modules/lodash/endsWith.js
trusty-cms-6.3.1 node_modules/lodash/endsWith.js
immosquare-cleaner-0.1.51 node_modules/lodash/endsWith.js
boring_generators-0.15.0 tmp/templates/app_template/node_modules/lodash/endsWith.js
clapton-0.0.26 lib/clapton/javascripts/node_modules/lodash/endsWith.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/lodash/endsWith.js
immosquare-cleaner-0.1.50 node_modules/lodash/endsWith.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/lodash/endsWith.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/lodash/endsWith.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/lodash/endsWith.js