aboutsummaryrefslogtreecommitdiff
path: root/node_modules/argparse/lib/utils.js
diff options
context:
space:
mode:
authorJoel Kronqvist <work.joelkronqvist@pm.me>2022-03-11 20:46:06 +0200
committerJoel Kronqvist <work.joelkronqvist@pm.me>2022-03-11 20:46:06 +0200
commit080c5819d87b933816d724a83f3bf4f1686770a7 (patch)
tree4a2ccc68b27edf7d4cbc586c932cc7542b655e19 /node_modules/argparse/lib/utils.js
parent5ac7049a9d30733165cc212dee308163c2a14644 (diff)
parentd003b82235a9329f912522a2f70aa950dfce4998 (diff)
downloadLYLLRuoka-080c5819d87b933816d724a83f3bf4f1686770a7.tar.gz
LYLLRuoka-080c5819d87b933816d724a83f3bf4f1686770a7.zip
Merge branch 'master' of https://github.com/JoelHMikael/FoodJS
Updating remote changes
Diffstat (limited to 'node_modules/argparse/lib/utils.js')
-rw-r--r--node_modules/argparse/lib/utils.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/node_modules/argparse/lib/utils.js b/node_modules/argparse/lib/utils.js
new file mode 100644
index 0000000..4a9cf3e
--- /dev/null
+++ b/node_modules/argparse/lib/utils.js
@@ -0,0 +1,57 @@
+'use strict';
+
+exports.repeat = function (str, num) {
+ var result = '';
+ for (var i = 0; i < num; i++) { result += str; }
+ return result;
+};
+
+exports.arrayEqual = function (a, b) {
+ if (a.length !== b.length) { return false; }
+ for (var i = 0; i < a.length; i++) {
+ if (a[i] !== b[i]) { return false; }
+ }
+ return true;
+};
+
+exports.trimChars = function (str, chars) {
+ var start = 0;
+ var end = str.length - 1;
+ while (chars.indexOf(str.charAt(start)) >= 0) { start++; }
+ while (chars.indexOf(str.charAt(end)) >= 0) { end--; }
+ return str.slice(start, end + 1);
+};
+
+exports.capitalize = function (str) {
+ return str.charAt(0).toUpperCase() + str.slice(1);
+};
+
+exports.arrayUnion = function () {
+ var result = [];
+ for (var i = 0, values = {}; i < arguments.length; i++) {
+ var arr = arguments[i];
+ for (var j = 0; j < arr.length; j++) {
+ if (!values[arr[j]]) {
+ values[arr[j]] = true;
+ result.push(arr[j]);
+ }
+ }
+ }
+ return result;
+};
+
+function has(obj, key) {
+ return Object.prototype.hasOwnProperty.call(obj, key);
+}
+
+exports.has = has;
+
+exports.extend = function (dest, src) {
+ for (var i in src) {
+ if (has(src, i)) { dest[i] = src[i]; }
+ }
+};
+
+exports.trimEnd = function (str) {
+ return str.replace(/\s+$/g, '');
+};