1.0.1 • Published 9 years ago

line-length v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

line-length.js

NPM version Bower version Build Status Build status Coverage Status devDependency Status

Get line length of a string

lineLength('aaaaaaaa\naaaaaaaaaaaaaaaaaaaa\r\naaaaaa\n'); //=> [8, 20, 6, 0]

Installation

Package managers

npm

npm install line-length

Bower

bower install line-length

Duo

const lineLength = require('shinnn/line-length.js');

Standalone

Download the script file directly.

API

lineLength(string)

string: String
Return: Array of Number

It returns an array of line length. "Line" means each part of a string splitted by \n and \r\n.

lineLength('foo'); //=> [3]
lineLength('\n'); //=> [0, 0]
lineLength(''); //=> [0]

License

Copyright (c) 2014 - 2015 Shinnosuke Watanabe

Licensed under the MIT License.