1.0.0 • Published 4 years ago

split-integer v1.0.0

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

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.