CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
1# strip-final-newline2 3> Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from a string/buffer4 5Can be useful when parsing the output of, for example, `ChildProcess#execFile`, as [binaries usually output a newline at the end](https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline). Normally, you would use `stdout.trim()`, but that would also remove newlines at the start and whitespace.6 7## Install8 9```10$ npm install strip-final-newline11```12 13## Usage14 15```js16import stripFinalNewline from 'strip-final-newline';17 18stripFinalNewline('foo\nbar\n\n');19//=> 'foo\nbar\n'20 21stripFinalNewline(Buffer.from('foo\nbar\n\n')).toString();22//=> 'foo\nbar\n'23```24 25---26 27<div align="center">28	<b>29		<a href="https://tidelift.com/subscription/pkg/npm-strip-eof?utm_source=npm-strip-eof&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>30	</b>31	<br>32	<sub>33		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.34	</sub>35</div>36 
basant307/AI_Governance_Project · CoolFace