endsWith.js 324 B

12345678910111213
  1. var toString = require('../lang/toString');
  2. /**
  3. * Checks if string ends with specified suffix.
  4. */
  5. function endsWith(str, suffix) {
  6. str = toString(str);
  7. suffix = toString(suffix);
  8. return str.indexOf(suffix, str.length - suffix.length) !== -1;
  9. }
  10. module.exports = endsWith;