ltrim.js 527 B

12345678910111213141516171819
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = ltrim;
  6. var _assertString = require('./util/assertString');
  7. var _assertString2 = _interopRequireDefault(_assertString);
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. function ltrim(str, chars) {
  10. (0, _assertString2.default)(str);
  11. var pattern = chars ? new RegExp('^[' + chars + ']+', 'g') : /^\s+/g;
  12. return str.replace(pattern, '');
  13. }
  14. module.exports = exports['default'];