strLeft.js 232 B

12345678
  1. var makeString = require('./helper/makeString');
  2. module.exports = function strLeft(str, sep) {
  3. str = makeString(str);
  4. sep = makeString(sep);
  5. var pos = !sep ? -1 : str.indexOf(sep);
  6. return~ pos ? str.slice(0, pos) : str;
  7. };