diff options
Diffstat (limited to 'node_modules/longest')
-rw-r--r-- | node_modules/longest/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/longest/README.md | 65 | ||||
-rw-r--r-- | node_modules/longest/index.js | 37 | ||||
-rw-r--r-- | node_modules/longest/package.json | 43 |
4 files changed, 166 insertions, 0 deletions
diff --git a/node_modules/longest/LICENSE b/node_modules/longest/LICENSE new file mode 100644 index 000000000..fa30c4cb3 --- /dev/null +++ b/node_modules/longest/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2015, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/longest/README.md b/node_modules/longest/README.md new file mode 100644 index 000000000..cdffe652b --- /dev/null +++ b/node_modules/longest/README.md @@ -0,0 +1,65 @@ +# longest [](http://badge.fury.io/js/longest) [](https://travis-ci.org/jonschlinkert/longest) + +> Get the longest item in an array. + +## Install with [npm](npmjs.org) + +```bash +npm i longest --save +``` +### Install with [bower](https://github.com/bower/bower) + +```bash +bower install longest --save +``` + +## Running tests +Install dev dependencies. + +```bash +npm i -d && npm test +``` + +## Usage + +```js +var longest = require('longest'); +longest(['a', 'abcde', 'abc']); +//=> 'abcde' + +longest(['a', 'abcde', 'abc']).length; +//=> 5 +``` + +## Related projects +* [longest-value](https://github.com/jonschlinkert/longest-value): Get the longest value for the given property from an array of objects. Useful for aligning values. +* [right-align-values](https://github.com/jonschlinkert/right-align-values): Right align the values of a given property for each object in an array. Useful for creating text columns or tables. +* [right-pad-values](https://github.com/jonschlinkert/right-pad-values): Right pad the values of a given property for each object in an array. Useful for creating text columns or tables. +* [repeat-string](https://github.com/jonschlinkert/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. +* [pad-right](https://github.com/jonschlinkert/pad-right): Right pad a string with zeros or a specified string. Fastest implementation. +* [pad-left](https://github.com/jonschlinkert/pad-left): Left pad a string with zeros or a specified string. Fastest implementation. + +## Running tests +Install dev dependencies. + +```bash +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/longest/issues) + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License +Copyright (c) 2015 Jon Schlinkert +Released under the MIT license + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 31, 2015._
\ No newline at end of file diff --git a/node_modules/longest/index.js b/node_modules/longest/index.js new file mode 100644 index 000000000..9892e52a1 --- /dev/null +++ b/node_modules/longest/index.js @@ -0,0 +1,37 @@ +/*! + * longest <https://github.com/jonschlinkert/longest> + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +module.exports = function(arr) { + if (!arr) { + return null; + } + + var len = arr.length; + if (!len) { + return null; + } + + var c = 0; + var i = 0; + var ele; + var elen; + var res; + + for (; i < len; i++) { + ele = arr[i].toString(); + elen = ele.length; + + if (elen > c) { + res = ele; + c = elen; + } + } + + return res; +}; diff --git a/node_modules/longest/package.json b/node_modules/longest/package.json new file mode 100644 index 000000000..76e7afd72 --- /dev/null +++ b/node_modules/longest/package.json @@ -0,0 +1,43 @@ +{ + "name": "longest", + "description": "Get the longest item in an array.", + "version": "1.0.1", + "homepage": "https://github.com/jonschlinkert/longest", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "repository": { + "type": "git", + "url": "https://github.com/jonschlinkert/longest.git" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/longest/issues" + }, + "license": { + "type": "MIT", + "url": "https://github.com/jonschlinkert/longest/blob/master/LICENSE" + }, + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "fill-range": "^2.1.0", + "mocha": "*" + }, + "keywords": [ + "array", + "element", + "item", + "long", + "length", + "longest" + ] +} |