split-integer
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

split-integer Travis CI Build Status

Split up an integer into even parts that add to the original integer.

NPM Badge

Install

npm install split-integer

Usage

const splitInteger = require("split-integer")
 
splitInteger(10, 2)
//=> [5, 5]
 
splitInteger(10, 3)
//=> [4, 3, 3]
 
splitInteger(10, 3, { smallestFirst: true })
//=> [3, 3, 4]

API

splitInteger(number, parts, options?)

number

Type: number

The number to split.

parts

Type: number

The amount of parts to split the number into.

options

Type: object

smallestFirst

Type: boolean
Default: false

Whether to order the smallest numbers first in the resulting array.

/split-integer/

    Package Sidebar

    Install

    npm i split-integer

    Weekly Downloads

    2

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    4 kB

    Total Files

    5

    Last publish

    Collaborators

    • richienb