Home Reference Source

ts_temp/string/endsWith.js

  1. import curryN from '../function/curryN';
  2. /**
  3. * Checks if a string ends with the provided postfix
  4. *
  5. * @param {string} postfix
  6. * @param {string} str
  7. * @return {Boolean}
  8. * @example
  9. *
  10. * endsWith('c', 'abc') //=> true
  11. * endsWith('b', 'abc') //=> false
  12. */
  13. export default curryN(2, (postfix = '', str = '') => str.slice(-postfix.length) === postfix);