1 line
9.3 KiB
JSON
1 line
9.3 KiB
JSON
{"id":"node_modules/left-pad/index.js","dependencies":[{"name":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/package.json","includedInParent":true,"mtime":1542067438335},{"name":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/left-pad/package.json","includedInParent":true,"mtime":1542058764034}],"generated":{"js":"/* This program is free software. It comes without any warranty, to\n * the extent permitted by applicable law. You can redistribute it\n * and/or modify it under the terms of the Do What The Fuck You Want\n * To Public License, Version 2, as published by Sam Hocevar. See\n * http://www.wtfpl.net/ for more details. */\n'use strict';\nmodule.exports = leftPad;\n\nvar cache = [\n '',\n ' ',\n ' ',\n ' ',\n ' ',\n ' ',\n ' ',\n ' ',\n ' ',\n ' '\n];\n\nfunction leftPad (str, len, ch) {\n // convert `str` to a `string`\n str = str + '';\n // `len` is the `pad`'s length now\n len = len - str.length;\n // doesn't need to pad\n if (len <= 0) return str;\n // `ch` defaults to `' '`\n if (!ch && ch !== 0) ch = ' ';\n // convert `ch` to a `string` cuz it could be a number\n ch = ch + '';\n // cache common use cases\n if (ch === ' ' && len < 10) return cache[len] + str;\n // `pad` starts with an empty string\n var pad = '';\n // loop\n while (true) {\n // add `ch` to `pad` if `len` is odd\n if (len & 1) pad += ch;\n // divide `len` by 2, ditch the remainder\n len >>= 1;\n // \"double\" the `ch` so this operation count grows logarithmically on `len`\n // each time `ch` is \"doubled\", the `len` would need to be \"doubled\" too\n // similar to finding a value in binary search tree, hence O(log(n))\n if (len) ch += ch;\n // `len` is 0, exit the loop\n else break;\n }\n // pad `str`!\n return pad + str;\n}\n","map":{"mappings":[{"source":"node_modules/left-pad/index.js","original":{"line":1,"column":0},"generated":{"line":1,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":2,"column":0},"generated":{"line":2,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":3,"column":0},"generated":{"line":3,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":4,"column":0},"generated":{"line":4,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":5,"column":0},"generated":{"line":5,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":6,"column":0},"generated":{"line":6,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":7,"column":0},"generated":{"line":7,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":8,"column":0},"generated":{"line":8,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":9,"column":0},"generated":{"line":9,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":10,"column":0},"generated":{"line":10,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":11,"column":0},"generated":{"line":11,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":12,"column":0},"generated":{"line":12,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":13,"column":0},"generated":{"line":13,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":14,"column":0},"generated":{"line":14,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":15,"column":0},"generated":{"line":15,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":16,"column":0},"generated":{"line":16,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":17,"column":0},"generated":{"line":17,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":18,"column":0},"generated":{"line":18,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":19,"column":0},"generated":{"line":19,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":20,"column":0},"generated":{"line":20,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":21,"column":0},"generated":{"line":21,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":22,"column":0},"generated":{"line":22,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":23,"column":0},"generated":{"line":23,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":24,"column":0},"generated":{"line":24,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":25,"column":0},"generated":{"line":25,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":26,"column":0},"generated":{"line":26,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":27,"column":0},"generated":{"line":27,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":28,"column":0},"generated":{"line":28,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":29,"column":0},"generated":{"line":29,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":30,"column":0},"generated":{"line":30,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":31,"column":0},"generated":{"line":31,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":32,"column":0},"generated":{"line":32,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":33,"column":0},"generated":{"line":33,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":34,"column":0},"generated":{"line":34,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":35,"column":0},"generated":{"line":35,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":36,"column":0},"generated":{"line":36,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":37,"column":0},"generated":{"line":37,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":38,"column":0},"generated":{"line":38,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":39,"column":0},"generated":{"line":39,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":40,"column":0},"generated":{"line":40,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":41,"column":0},"generated":{"line":41,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":42,"column":0},"generated":{"line":42,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":43,"column":0},"generated":{"line":43,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":44,"column":0},"generated":{"line":44,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":45,"column":0},"generated":{"line":45,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":46,"column":0},"generated":{"line":46,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":47,"column":0},"generated":{"line":47,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":48,"column":0},"generated":{"line":48,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":49,"column":0},"generated":{"line":49,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":50,"column":0},"generated":{"line":50,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":51,"column":0},"generated":{"line":51,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":52,"column":0},"generated":{"line":52,"column":0}},{"source":"node_modules/left-pad/index.js","original":{"line":53,"column":0},"generated":{"line":53,"column":0}}],"sources":{"node_modules/left-pad/index.js":"/* This program is free software. It comes without any warranty, to\n * the extent permitted by applicable law. You can redistribute it\n * and/or modify it under the terms of the Do What The Fuck You Want\n * To Public License, Version 2, as published by Sam Hocevar. See\n * http://www.wtfpl.net/ for more details. */\n'use strict';\nmodule.exports = leftPad;\n\nvar cache = [\n '',\n ' ',\n ' ',\n ' ',\n ' ',\n ' ',\n ' ',\n ' ',\n ' ',\n ' '\n];\n\nfunction leftPad (str, len, ch) {\n // convert `str` to a `string`\n str = str + '';\n // `len` is the `pad`'s length now\n len = len - str.length;\n // doesn't need to pad\n if (len <= 0) return str;\n // `ch` defaults to `' '`\n if (!ch && ch !== 0) ch = ' ';\n // convert `ch` to a `string` cuz it could be a number\n ch = ch + '';\n // cache common use cases\n if (ch === ' ' && len < 10) return cache[len] + str;\n // `pad` starts with an empty string\n var pad = '';\n // loop\n while (true) {\n // add `ch` to `pad` if `len` is odd\n if (len & 1) pad += ch;\n // divide `len` by 2, ditch the remainder\n len >>= 1;\n // \"double\" the `ch` so this operation count grows logarithmically on `len`\n // each time `ch` is \"doubled\", the `len` would need to be \"doubled\" too\n // similar to finding a value in binary search tree, hence O(log(n))\n if (len) ch += ch;\n // `len` is 0, exit the loop\n else break;\n }\n // pad `str`!\n return pad + str;\n}\n"},"lineCount":53}},"hash":"574f1eb05d260d0cc1a93322fea1f872","cacheData":{"env":{}}} |