startsWith.js 301 B

12345678910111213
  1. var toString = require('../lang/toString');
  2. /**
  3. * Checks if string starts with specified prefix.
  4. */
  5. function startsWith(str, prefix) {
  6. str = toString(str);
  7. prefix = toString(prefix);
  8. return str.indexOf(prefix) === 0;
  9. }
  10. module.exports = startsWith;