summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/cli-table2/node_modules/lodash/internal/trimmedRightIndex.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/cli-table2/node_modules/lodash/internal/trimmedRightIndex.js')
-rw-r--r--deps/npm/node_modules/cli-table2/node_modules/lodash/internal/trimmedRightIndex.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/internal/trimmedRightIndex.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/internal/trimmedRightIndex.js
new file mode 100644
index 0000000000..71b9e38a62
--- /dev/null
+++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/internal/trimmedRightIndex.js
@@ -0,0 +1,18 @@
+var isSpace = require('./isSpace');
+
+/**
+ * Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace
+ * character of `string`.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {number} Returns the index of the last non-whitespace character.
+ */
+function trimmedRightIndex(string) {
+ var index = string.length;
+
+ while (index-- && isSpace(string.charCodeAt(index))) {}
+ return index;
+}
+
+module.exports = trimmedRightIndex;