parse-int-x

WebJar for parse-int-x

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

parse-int-x
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

parse-int-x
WebJar for parse-int-x
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/Xotic750/parse-int-x

Download parse-int-x

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/parse-int-x/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>parse-int-x</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/parse-int-x/
implementation 'org.webjars.npm:parse-int-x:2.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/parse-int-x/
implementation ("org.webjars.npm:parse-int-x:2.0.0")
'org.webjars.npm:parse-int-x:jar:2.0.0'
<dependency org="org.webjars.npm" name="parse-int-x" rev="2.0.0">
  <artifact name="parse-int-x" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='parse-int-x', version='2.0.0')
)
libraryDependencies += "org.webjars.npm" % "parse-int-x" % "2.0.0"
[org.webjars.npm/parse-int-x "2.0.0"]

Dependencies

compile (4)

Group / Artifact Type Version
org.webjars.npm : cached-constructors-x jar [1.0.0,2)
org.webjars.npm : nan-x jar [1.0.0,2)
org.webjars.npm : to-string-x jar [1.4.2,2)
org.webjars.npm : trim-left-x jar [3.0.0,4)

Project Modules

There are no modules declared in this project.

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

parse-int-x

Parses a string argument and returns an integer of the specified radix.

module.exports(string, number)number

parse-int-xnumber

This method parses a string argument and returns an integer of the specified radix (the base in mathematical numeral systems). (ES2019)

Kind: static property of parse-int-x
Returns: number - An integer number parsed from the given string. If the first character cannot be converted to a number, NaN is returned.
Throws:

  • TypeError If target is a Symbol or is not coercible.
Param Type Description
string string The value to parse. If the string argument is not a string, then it is converted to a string (using the ToString abstract operation). Leading whitespace in the string argument is ignored.
radix number An integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the above mentioned string. Specify 10 for the decimal numeral system commonly used by humans. Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. Different implementations produce different results when a radix is not specified, usually defaulting the value to 10.

Example

import $parseInt from 'parse-int-x';

// The following examples all return 15
console.log($parseInt(' 0xF', 16));
console.log($parseInt(' F', 16));
console.log($parseInt('17', 8));
console.log($parseInt(021, 8));
console.log($parseInt('015', 10)); // $parseInt(015, 10); will return 15
console.log($parseInt(15.99, 10));
console.log($parseInt('15,123', 10));
console.log($parseInt('FXX123', 16));
console.log($parseInt('1111', 2));
console.log($parseInt('15 * 3', 10));
console.log($parseInt('15e2', 10));
console.log($parseInt('15px', 10));
console.log($parseInt('12', 13));

//The following examples all return NaN:
console.log($parseInt('Hello', 8)); // Not a number at all
console.log($parseInt('546', 2)); // Digits are not valid for binary representations

Versions

Version
2.0.0