diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-03-29 04:03:49 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-28 13:03:49 -0400 |
commit | bced52505f32d6cca4f944bb610a8a26767908a8 (patch) | |
tree | da49a5df4b7bd6f8306248069228cd6bd0db1303 /std/node/tests/node_modules/left-pad/index.js | |
parent | 1397b8e0e7c85762e19d88fde103342bfa563360 (diff) |
Update to Prettier 2 and use ES Private Fields (#4498)
Diffstat (limited to 'std/node/tests/node_modules/left-pad/index.js')
-rw-r--r-- | std/node/tests/node_modules/left-pad/index.js | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/std/node/tests/node_modules/left-pad/index.js b/std/node/tests/node_modules/left-pad/index.js index e90aec35d..8501bca1b 100644 --- a/std/node/tests/node_modules/left-pad/index.js +++ b/std/node/tests/node_modules/left-pad/index.js @@ -3,37 +3,37 @@ * and/or modify it under the terms of the Do What The Fuck You Want * To Public License, Version 2, as published by Sam Hocevar. See * http://www.wtfpl.net/ for more details. */ -'use strict'; +"use strict"; module.exports = leftPad; var cache = [ - '', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ' + "", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " ]; -function leftPad (str, len, ch) { +function leftPad(str, len, ch) { // convert `str` to a `string` - str = str + ''; + str = str + ""; // `len` is the `pad`'s length now len = len - str.length; // doesn't need to pad if (len <= 0) return str; // `ch` defaults to `' '` - if (!ch && ch !== 0) ch = ' '; + if (!ch && ch !== 0) ch = " "; // convert `ch` to a `string` cuz it could be a number - ch = ch + ''; + ch = ch + ""; // cache common use cases - if (ch === ' ' && len < 10) return cache[len] + str; + if (ch === " " && len < 10) return cache[len] + str; // `pad` starts with an empty string - var pad = ''; + var pad = ""; // loop while (true) { // add `ch` to `pad` if `len` is odd |