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