lodash

4.17.204.17.21
_baseTrim.js
_baseTrim.js
+19
Index: package/_baseTrim.js
===================================================================
--- package/_baseTrim.js
+++ package/_baseTrim.js
@@ -0,0 +1,19 @@
+var trimmedEndIndex = require('./_trimmedEndIndex');
+
+/** Used to match leading whitespace. */
+var reTrimStart = /^\s+/;
+
+/**
+ * The base implementation of `_.trim`.
+ *
+ * @private
+ * @param {string} string The string to trim.
+ * @returns {string} Returns the trimmed string.
+ */
+function baseTrim(string) {
+  return string
+    ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
+    : string;
+}
+
+module.exports = baseTrim;