MCPcopy Create free account
hub / github.com/BridgeAR/safe-stable-stringify / getPositiveIntegerOption

Function getPositiveIntegerOption

index.js:122–137  ·  view source on GitHub ↗
(options, key)

Source from the content-addressed store, hash-verified

120}
121
122function getPositiveIntegerOption (options, key) {
123 let value
124 if (hasOwnProperty.call(options, key)) {
125 value = options[key]
126 if (typeof value !== 'number') {
127 throw new TypeError(`The "${key}" argument must be of type number`)
128 }
129 if (!Number.isInteger(value)) {
130 throw new TypeError(`The "${key}" argument must be an integer`)
131 }
132 if (value < 1) {
133 throw new RangeError(`The "${key}" argument must be >= 1`)
134 }
135 }
136 return value === undefined ? Infinity : value
137}
138
139function getItemCount (number) {
140 if (number === 1) {

Callers 1

configureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…