Utilities for the number of logical cores.
npm install --save hardware-concurrency
# or
yarn add hardware-concurrencyfunction maxCores(): numberTake the number of cores.
Equivalent to navigator.hardwareConcurrency or os.cpus().length.
function halfCores(): numberTake half the number of cores and round up.
function doubleCores(): numberTake double the number of cores.
function minus1Cores(): numberEquivalent to Math.max(maxCores() - 1, 1).
function minusCores(num: number): numberEquivalent to Math.max(maxCores() - num, 1).