7 ms·
Mirroring other comments, this seems a bit trivial to be its own package and looking at the source, it seems to not cover cases where the local storage value ca
by mdtusz 7y ago
Mirroring other comments, this seems a bit trivial to be its own package and looking at the source, it seems to not cover cases where the local storage value can't be parsed.
https://usehooks.com/useLocalStorage/ https://usehooks.com/useLocalStorage/ has a safer implementation and is free to copy (Unlicense).
- brudgers 7y agoIt seems less trivial than PadLeft. https://arstechnica.com/information-technology/2016/03/rage-quit-coder-unpublished-17-lines-of-javascript-and-broke-the-internet/ https://arstechnica.com/information-technology/2016/03/rage-...
- crtlaltdel 7y agoas a joke i got a shirt with left-pad's source printed on it. #neverforget
- quickthrower2 7y agoI was playing with String.prototype.padLeft earlier and boy that has weird semantics. For the padding length, strings are parsed. NaN is 0, Infinity throws an error, negative Infinity is 0, true is 1. Good ol’ JS!
- sktrdie 7y agoAlso not even test cases for such simple code.