UNPKG

cr

Version:

Strip windows carriage returns, or convert carriage returns to newlines.

69 lines (45 loc) 2 kB
# cr [![NPM version](https://badge.fury.io/js/cr.svg)](http://badge.fury.io/js/cr) > Strip windows carriage returns, or convert carriage returns to newlines. ## Install Install with [npm](https://www.npmjs.com/) ```sh $ npm i cr --save ``` ## Usage ```js var cr = require('cr'); cr('a\r\nb\r\nc'); //=> 'a\nb\nc' cr('a\rb\rc'); //=> 'a\nb\nc' ``` **Strip carriage returns** ```js var cr = require('cr'); cr.strip('a\r\nb\r\nc'); //=> 'a\nb\nc' cr.strip('a\rb\rc'); //=> 'abc' ``` ## Related projects * [copy](https://www.npmjs.com/package/copy): Copy files or directories using globs. | [homepage](https://github.com/jonschlinkert/copy) * [read-data](https://www.npmjs.com/package/read-data): Read JSON or YAML files. | [homepage](https://github.com/jonschlinkert/read-data) * [read-file](https://www.npmjs.com/package/read-file): Thin wrapper around fs.readFile and fs.readFileSync that also strips byte order marks when `utf8` encoding… [more](https://www.npmjs.com/package/read-file) | [homepage](https://github.com/jonschlinkert/read-file) * [read-yaml](https://www.npmjs.com/package/read-yaml): Very thin wrapper around js-yaml for directly reading in YAML files. | [homepage](https://github.com/jonschlinkert/read-yaml) * [write](https://www.npmjs.com/package/write): Write files to disk, creating intermediate directories if they don't exist. | [homepage](https://github.com/jonschlinkert/write) ## Running tests Install dev dependencies: ```sh $ npm i -d && npm test ``` ## Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/cr/issues/new). ## Author **Jon Schlinkert** + [github/jonschlinkert](https://github.com/jonschlinkert) + [twitter/jonschlinkert](http://twitter.com/jonschlinkert) ## License Copyright © 2015 Jon Schlinkert Released under the MIT license. *** _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 10, 2015._