parse-exponential
Version:
Parse an exponential notation string into parts
36 lines (22 loc) • 905 B
Markdown
> Parse an exponential notation string into parts
```
$ npm install --save parse-exponential
```
```js
var parseExponential = require('parse-exponential')
(10).toExponential() // => '1e+1'
parseExponential('1e+1')
//=> ['1', '+1']
```
Parses an exponential into an a array of length 2 containing the coefficient and exponent.
*Required*
Type: `string`
An exponential notation string. Should follow the format returned by [`Number.prototype.toExponential`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential).
MIT © [Ben Drucker](http://bendrucker.me)