kai zhu kaizhu256 at
Sat Jan 12 22:29:15 UTC 2019

a common use-case i have is counting newlines in largish (> 200kb) embedded-js files, like this real-world example [1].  ultimately meant for line-number-preservation purposes in auto-lint/auto-prettify tasks (which have been getting slower due to complexity).

would a new RegExp count-method like ```(/\n/g).count(largeCode)``` be significantly more efficient than existing ```largeCode.split("\n").length - 1``` or ```largeCode.replace((/[^\n]+/g), "").length```?


[1] calculating and reproducing line-number offsets when linting/autofixing files <> <>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list