1.2.2 • Published 6 years ago

positive-number-array v1.2.2

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

positive-number-array

Greenkeeper badge Build Status Coverage Status

Parses input (string | array), returning an array of positive numbers. Zero or negative numbers are ignored.

Installation

npm i positive-number-array -S

Dependencies

None. Suitable for usage on nodejs or on the browser, via browserify.

Initialization

const positiveNumberArray = require('positive-number-array');

Usage

Pass a single number or a string or an array or a JSON-stringified array as input, returns a new array of positive numbers.

positiveNumberArray("1,2,3,4,5")
positiveNumberArray("1 2 3 4 5")
positiveNumberArray("1  2  3  4  5 ")
positiveNumberArray("1,2 3 4 5 ")
positiveNumberArray("1 chicken 2 trolls 3 4 5 mylady")
positiveNumberArray([1,2,3,0,0,4,-1,5])
positiveNumberArray("[1,2,3,4,5]")
--> [1,2,3,4,5]
positiveNumberArray(-1)
-->[]
positiveNumberArray(0.5)
-->[0.5]

Tests

Use mocha framework.

Copyright

Copyright 2016 Paul Brewer, Economic and Financial Technology Consulting LLC

License

MIT

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

8 years ago

1.0.0

8 years ago