mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
Bump to v3.0.0.
This commit is contained in:
22
lodash.parseint/LICENSE.txt
Normal file
22
lodash.parseint/LICENSE.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas,
|
||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||
|
||||
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.
|
||||
20
lodash.parseint/README.md
Normal file
20
lodash.parseint/README.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# lodash.parseint v3.0.0
|
||||
|
||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.parseInt` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module.
|
||||
|
||||
## Installation
|
||||
|
||||
Using npm:
|
||||
|
||||
```bash
|
||||
$ {sudo -H} npm i -g npm
|
||||
$ npm i --save lodash.parseint
|
||||
```
|
||||
|
||||
In Node.js/io.js:
|
||||
|
||||
```js
|
||||
var parseInt = require('lodash.parseint');
|
||||
```
|
||||
|
||||
See the [documentation](https://lodash.com/docs#parseInt) or [package source](https://github.com/lodash/lodash/blob/3.0.0-npm-packages/lodash.parseint) for more details.
|
||||
75
lodash.parseint/index.js
Normal file
75
lodash.parseint/index.js
Normal file
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modern modularize exports="npm" -o ./`
|
||||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
|
||||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
* Available under MIT license <https://lodash.com/license>
|
||||
*/
|
||||
var isIterateeCall = require('lodash._isiterateecall'),
|
||||
trim = require('lodash.trim');
|
||||
|
||||
/** Used to detect hexadecimal string values. */
|
||||
var reHexPrefix = /^0[xX]/;
|
||||
|
||||
/** Used to detect and test for whitespace. */
|
||||
var whitespace = (
|
||||
// Basic whitespace characters.
|
||||
' \t\x0b\f\xa0\ufeff' +
|
||||
|
||||
// Line terminators.
|
||||
'\n\r\u2028\u2029' +
|
||||
|
||||
// Unicode category "Zs" space separators.
|
||||
'\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
|
||||
);
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
var nativeParseInt = global.parseInt;
|
||||
|
||||
/**
|
||||
* Converts `string` to an integer of the specified radix. If `radix` is
|
||||
* `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,
|
||||
* in which case a `radix` of `16` is used.
|
||||
*
|
||||
* **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E)
|
||||
* of `parseInt`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category String
|
||||
* @param {string} string The string to convert.
|
||||
* @param {number} [radix] The radix to interpret `value` by.
|
||||
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
|
||||
* @returns {number} Returns the converted integer.
|
||||
* @example
|
||||
*
|
||||
* _.parseInt('08');
|
||||
* // => 8
|
||||
*
|
||||
* _.map(['6', '08', '10'], _.parseInt);
|
||||
* // => [6, 8, 10]
|
||||
*/
|
||||
function parseInt(string, radix, guard) {
|
||||
if (guard && isIterateeCall(string, radix, guard)) {
|
||||
radix = 0;
|
||||
}
|
||||
return nativeParseInt(string, radix);
|
||||
}
|
||||
// Fallback for environments with pre-ES5 implementations.
|
||||
if (nativeParseInt(whitespace + '08') != 8) {
|
||||
parseInt = function(string, radix, guard) {
|
||||
// Firefox < 21 and Opera < 15 follow ES3 for `parseInt`.
|
||||
// Chrome fails to trim leading <BOM> whitespace characters.
|
||||
// See https://code.google.com/p/v8/issues/detail?id=3109 for more details.
|
||||
if (guard ? isIterateeCall(string, radix, guard) : radix == null) {
|
||||
radix = 0;
|
||||
} else if (radix) {
|
||||
radix = +radix;
|
||||
}
|
||||
string = trim(string);
|
||||
return nativeParseInt(string, radix || (reHexPrefix.test(string) ? 16 : 10));
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = parseInt;
|
||||
23
lodash.parseint/package.json
Normal file
23
lodash.parseint/package.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "lodash.parseint",
|
||||
"version": "3.0.0",
|
||||
"description": "The modern build of lodash’s `_.parseInt` as a module.",
|
||||
"homepage": "https://lodash.com/",
|
||||
"icon": "https://lodash.com/icon.svg",
|
||||
"license": "MIT",
|
||||
"keywords": "lodash, lodash-modularized, stdlib, util",
|
||||
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
||||
"contributors": [
|
||||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
||||
"Benjamin Tan <demoneaux@gmail.com> (https://d10.github.io/)",
|
||||
"Blaine Bublitz <blaine@iceddev.com> (http://www.iceddev.com/)",
|
||||
"Kit Cambridge <github@kitcambridge.be> (http://kitcambridge.be/)",
|
||||
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)"
|
||||
],
|
||||
"repository": "lodash/lodash",
|
||||
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" },
|
||||
"dependencies": {
|
||||
"lodash._isiterateecall": "^3.0.0",
|
||||
"lodash.trim": "^3.0.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user