summaryrefslogtreecommitdiff
path: root/node_modules/locutus/c/stdio
diff options
context:
space:
mode:
authorMarvin Borner2018-11-07 22:10:16 +0100
committerMarvin Borner2018-11-07 22:10:17 +0100
commit954583f3d56fbfb60321725f13ad092e536e3737 (patch)
treea0505a763797582c61fd8c2f90b422456d8874c9 /node_modules/locutus/c/stdio
parent1c355e6e956a4e507ed5436d0c814ba9c3a1deb2 (diff)
Removed node_modules
Diffstat (limited to 'node_modules/locutus/c/stdio')
-rw-r--r--node_modules/locutus/c/stdio/index.js4
-rw-r--r--node_modules/locutus/c/stdio/index.js.map1
-rw-r--r--node_modules/locutus/c/stdio/sprintf.js135
-rw-r--r--node_modules/locutus/c/stdio/sprintf.js.map1
4 files changed, 0 insertions, 141 deletions
diff --git a/node_modules/locutus/c/stdio/index.js b/node_modules/locutus/c/stdio/index.js
deleted file mode 100644
index 758c66d..0000000
--- a/node_modules/locutus/c/stdio/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-'use strict';
-
-module.exports['sprintf'] = require('./sprintf');
-//# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/node_modules/locutus/c/stdio/index.js.map b/node_modules/locutus/c/stdio/index.js.map
deleted file mode 100644
index 5542070..0000000
--- a/node_modules/locutus/c/stdio/index.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["../../../src/c/stdio/index.js"],"names":["module","exports","require"],"mappings":";;AAAAA,OAAOC,OAAP,CAAe,SAAf,IAA4BC,QAAQ,WAAR,CAA5B","file":"index.js","sourcesContent":["module.exports['sprintf'] = require('./sprintf')\n"]} \ No newline at end of file
diff --git a/node_modules/locutus/c/stdio/sprintf.js b/node_modules/locutus/c/stdio/sprintf.js
deleted file mode 100644
index c7d0cad..0000000
--- a/node_modules/locutus/c/stdio/sprintf.js
+++ /dev/null
@@ -1,135 +0,0 @@
-'use strict';
-
-function pad(str, minLength, padChar, leftJustify) {
- var diff = minLength - str.length;
- var padStr = padChar.repeat(Math.max(0, diff));
-
- return leftJustify ? str + padStr : padStr + str;
-}
-
-module.exports = function sprintf(format) {
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
-
- // original by: Rafał Kukawski
- // example 1: sprintf('%+10.*d', 5, 1)
- // returns 1: ' +00001'
- var placeholderRegex = /%(?:(\d+)\$)?([-+#0 ]*)(\*|\d+)?(?:\.(\*|\d*))?([\s\S])/g;
-
- var index = 0;
-
- return format.replace(placeholderRegex, function (match, param, flags, width, prec, modifier) {
- var leftJustify = flags.includes('-');
-
- // flag '0' is ignored when flag '-' is present
- var padChar = leftJustify ? ' ' : flags.split('').reduce(function (pc, c) {
- return [' ', '0'].includes(c) ? c : pc;
- }, ' ');
-
- var positiveSign = flags.includes('+') ? '+' : flags.includes(' ') ? ' ' : '';
-
- var minWidth = width === '*' ? args[index++] : +width || 0;
- var precision = prec === '*' ? args[index++] : +prec;
-
- if (param && !+param) {
- throw Error('Param index must be greater than 0');
- }
-
- if (param && +param > args.length) {
- throw Error('Too few arguments');
- }
-
- // compiling with default clang params, mixed positional and non-positional params
- // give only a warning
- var arg = param ? args[param - 1] : args[index++];
-
- if (precision === undefined || isNaN(precision)) {
- precision = 'eEfFgG'.includes(modifier) ? 6 : modifier === 's' ? String(arg).length : undefined;
- }
-
- switch (modifier) {
- case '%':
- return '%';
- case 'd':
- case 'i':
- {
- var number = Math.trunc(+arg || 0);
- var abs = Math.abs(number);
- var prefix = number < 0 ? '-' : positiveSign;
-
- var str = pad(abs.toString(), precision || 0, '0', false);
-
- if (padChar === '0') {
- return prefix + pad(str, minWidth - prefix.length, padChar, leftJustify);
- }
-
- return pad(prefix + str, minWidth, padChar, leftJustify);
- }
- case 'e':
- case 'E':
- case 'f':
- case 'F':
- case 'g':
- case 'G':
- {
- var _number = +arg;
- var _abs = Math.abs(_number);
- var _prefix = _number < 0 ? '-' : positiveSign;
-
- var op = [Number.prototype.toExponential, Number.prototype.toFixed, Number.prototype.toPrecision]['efg'.indexOf(modifier.toLowerCase())];
-
- var tr = [String.prototype.toLowerCase, String.prototype.toUpperCase]['eEfFgG'.indexOf(modifier) % 2];
-
- var isSpecial = isNaN(_abs) || !isFinite(_abs);
-
- var _str = isSpecial ? _abs.toString().substr(0, 3) : op.call(_abs, precision);
-
- if (padChar === '0' && !isSpecial) {
- return _prefix + pad(tr.call(_str), minWidth - _prefix.length, padChar, leftJustify);
- }
-
- return pad(tr.call(_prefix + _str), minWidth, isSpecial ? ' ' : padChar, leftJustify);
- }
- case 'b':
- case 'o':
- case 'u':
- case 'x':
- case 'X':
- {
- var _number2 = +arg || 0;
- var intVal = Math.trunc(_number2) + (_number2 < 0 ? 0xFFFFFFFF + 1 : 0);
- var base = [2, 8, 10, 16, 16]['bouxX'.indexOf(modifier)];
- var _prefix2 = intVal && flags.includes('#') ? ['', '0', '', '0x', '0X']['bouxXX'.indexOf(modifier)] : '';
-
- if (padChar === '0' && _prefix2) {
- return _prefix2 + pad(pad(intVal.toString(base), precision, '0', false), minWidth - _prefix2.length, padChar, leftJustify);
- }
-
- return pad(_prefix2 + pad(intVal.toString(base), precision, '0', false), minWidth, padChar, leftJustify);
- }
- case 'p':
- case 'n':
- {
- throw Error('\'' + modifier + '\' modifier not supported');
- }
- case 's':
- {
- return pad(String(arg).substr(0, precision), minWidth, padChar, leftJustify);
- }
- case 'c':
- {
- // extension, if arg is string, take first char
- var chr = typeof arg === 'string' ? arg.charAt(0) : String.fromCharCode(+arg);
- return pad(chr, minWidth, padChar, leftJustify);
- }
- case 'a':
- case 'A':
- throw Error('\'' + modifier + '\' modifier not yet implemented');
- default:
- // for unknown modifiers, return the modifier char
- return modifier;
- }
- });
-};
-//# sourceMappingURL=sprintf.js.map \ No newline at end of file
diff --git a/node_modules/locutus/c/stdio/sprintf.js.map b/node_modules/locutus/c/stdio/sprintf.js.map
deleted file mode 100644
index 6a2ddbb..0000000
--- a/node_modules/locutus/c/stdio/sprintf.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["../../../src/c/stdio/sprintf.js"],"names":["pad","str","minLength","padChar","leftJustify","diff","length","padStr","repeat","Math","max","module","exports","sprintf","format","args","placeholderRegex","index","replace","match","param","flags","width","prec","modifier","includes","split","reduce","pc","c","positiveSign","minWidth","precision","Error","arg","undefined","isNaN","String","number","trunc","abs","prefix","toString","op","Number","prototype","toExponential","toFixed","toPrecision","indexOf","toLowerCase","tr","toUpperCase","isSpecial","isFinite","substr","call","intVal","base","chr","charAt","fromCharCode"],"mappings":";;AAAA,SAASA,GAAT,CAAcC,GAAd,EAAmBC,SAAnB,EAA8BC,OAA9B,EAAuCC,WAAvC,EAAoD;AAClD,MAAMC,OAAOH,YAAYD,IAAIK,MAA7B;AACA,MAAMC,SAASJ,QAAQK,MAAR,CAAeC,KAAKC,GAAL,CAAS,CAAT,EAAYL,IAAZ,CAAf,CAAf;;AAEA,SAAOD,cAAcH,MAAMM,MAApB,GAA6BA,SAASN,GAA7C;AACD;;AAEDU,OAAOC,OAAP,GAAiB,SAASC,OAAT,CAAkBC,MAAlB,EAAmC;AAAA,oCAANC,IAAM;AAANA,QAAM;AAAA;;AAClD;AACA;AACA;AACA,MAAMC,mBAAmB,0DAAzB;;AAEA,MAAIC,QAAQ,CAAZ;;AAEA,SAAOH,OAAOI,OAAP,CAAeF,gBAAf,EAAiC,UAAUG,KAAV,EAAiBC,KAAjB,EAAwBC,KAAxB,EAA+BC,KAA/B,EAAsCC,IAAtC,EAA4CC,QAA5C,EAAsD;AAC5F,QAAMpB,cAAciB,MAAMI,QAAN,CAAe,GAAf,CAApB;;AAEA;AACA,QAAMtB,UAAUC,cAAc,GAAd,GACIiB,MAAMK,KAAN,CAAY,EAAZ,EAAgBC,MAAhB,CAAuB,UAACC,EAAD,EAAKC,CAAL;AAAA,aAAW,CAAC,GAAD,EAAM,GAAN,EAAWJ,QAAX,CAAoBI,CAApB,IAAyBA,CAAzB,GAA6BD,EAAxC;AAAA,KAAvB,EAAmE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AAZ,CAAmB,CAAnB,EAAsBvB,SAAtB,CAAJ,EAAsCD,QAAtC,EAAgD5B,OAAhD,EAAyDC,WAAzD,CAAP;AACD;AACD,WAAK,GAAL;AAAU;AACR;AACA,cAAMuD,MAAM,OAAOzB,GAAP,KAAe,QAAf,GAA0BA,IAAI0B,MAAJ,CAAW,CAAX,CAA1B,GAA0CvB,OAAOwB,YAAP,CAAoB,CAAC3B,GAArB,CAAtD;AACA,iBAAOlC,IAAI2D,GAAJ,EAAS5B,QAAT,EAAmB5B,OAAnB,EAA4BC,WAA5B,CAAP;AACD;AACD,WAAK,GAAL;AACA,WAAK,GAAL;AACE,cAAM6B,aAAUT,QAAV,qCAAN;AACF;AACE;AACA,eAAOA,QAAP;AAjFJ;AAmFD,GA/GM,CAAP;AAgHD,CAxHD","file":"sprintf.js","sourcesContent":["function pad (str, minLength, padChar, leftJustify) {\n const diff = minLength - str.length\n const padStr = padChar.repeat(Math.max(0, diff))\n\n return leftJustify ? str + padStr : padStr + str\n}\n\nmodule.exports = function sprintf (format, ...args) {\n // original by: Rafał Kukawski\n // example 1: sprintf('%+10.*d', 5, 1)\n // returns 1: ' +00001'\n const placeholderRegex = /%(?:(\\d+)\\$)?([-+#0 ]*)(\\*|\\d+)?(?:\\.(\\*|\\d*))?([\\s\\S])/g\n\n let index = 0\n\n return format.replace(placeholderRegex, function (match, param, flags, width, prec, modifier) {\n const leftJustify = flags.includes('-')\n\n // flag '0' is ignored when flag '-' is present\n const padChar = leftJustify ? ' '\n : flags.split('').reduce((pc, c) => [' ', '0'].includes(c) ? c : pc, ' ')\n\n const positiveSign = flags.includes('+') ? '+' : flags.includes(' ') ? ' ' : ''\n\n const minWidth = width === '*' ? args[index++] : +width || 0\n let precision = prec === '*' ? args[index++] : +prec\n\n if (param && !+param) {\n throw Error(`Param index must be greater than 0`)\n }\n\n if (param && +param > args.length) {\n throw Error(`Too few arguments`)\n }\n\n // compiling with default clang params, mixed positional and non-positional params\n // give only a warning\n const arg = param ? args[param - 1] : args[index++]\n\n if (precision === undefined || isNaN(precision)) {\n precision = 'eEfFgG'.includes(modifier) ? 6 : (modifier === 's' ? String(arg).length : undefined)\n }\n\n switch (modifier) {\n case '%':\n return '%'\n case 'd':\n case 'i': {\n const number = Math.trunc(+arg || 0)\n const abs = Math.abs(number)\n const prefix = number < 0 ? '-' : positiveSign\n\n const str = pad(abs.toString(), precision || 0, '0', false)\n\n if (padChar === '0') {\n return prefix + pad(str, minWidth - prefix.length, padChar, leftJustify)\n }\n\n return pad(prefix + str, minWidth, padChar, leftJustify)\n }\n case 'e':\n case 'E':\n case 'f':\n case 'F':\n case 'g':\n case 'G': {\n const number = +arg\n const abs = Math.abs(number)\n const prefix = number < 0 ? '-' : positiveSign\n\n const op = [\n Number.prototype.toExponential,\n Number.prototype.toFixed,\n Number.prototype.toPrecision\n ]['efg'.indexOf(modifier.toLowerCase())]\n\n const tr = [\n String.prototype.toLowerCase,\n String.prototype.toUpperCase\n ]['eEfFgG'.indexOf(modifier) % 2]\n\n const isSpecial = isNaN(abs) || !isFinite(abs)\n\n let str = isSpecial ? abs.toString().substr(0, 3) : op.call(abs, precision)\n\n if (padChar === '0' && !isSpecial) {\n return prefix + pad(tr.call(str), minWidth - prefix.length, padChar, leftJustify)\n }\n\n return pad(tr.call(prefix + str), minWidth, isSpecial ? ' ' : padChar, leftJustify)\n }\n case 'b':\n case 'o':\n case 'u':\n case 'x':\n case 'X': {\n const number = +arg || 0\n const intVal = Math.trunc(number) + (number < 0 ? 0xFFFFFFFF + 1 : 0)\n const base = [2, 8, 10, 16, 16]['bouxX'.indexOf(modifier)]\n const prefix = intVal && flags.includes('#') ? ['', '0', '', '0x', '0X']['bouxXX'.indexOf(modifier)] : ''\n\n if (padChar === '0' && prefix) {\n return prefix + pad(pad(intVal.toString(base), precision, '0', false), minWidth - prefix.length, padChar, leftJustify)\n }\n\n return pad(prefix + pad(intVal.toString(base), precision, '0', false), minWidth, padChar, leftJustify)\n }\n case 'p':\n case 'n': {\n throw Error(`'${modifier}' modifier not supported`)\n }\n case 's': {\n return pad(String(arg).substr(0, precision), minWidth, padChar, leftJustify)\n }\n case 'c': {\n // extension, if arg is string, take first char\n const chr = typeof arg === 'string' ? arg.charAt(0) : String.fromCharCode(+arg)\n return pad(chr, minWidth, padChar, leftJustify)\n }\n case 'a':\n case 'A':\n throw Error(`'${modifier}' modifier not yet implemented`)\n default:\n // for unknown modifiers, return the modifier char\n return modifier\n }\n })\n}\n"]} \ No newline at end of file