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

Function getPositiveIntegerOption

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

Source from the content-addressed store, hash-verified

176}
177
178function getPositiveIntegerOption (options, key) {
179 let value
180 if (hasOwnProperty.call(options, key)) {
181 value = options[key]
182 if (typeof value !== 'number') {
183 throw new TypeError(`The "${key}" argument must be of type number`)
184 }
185 if (!Number.isInteger(value)) {
186 throw new TypeError(`The "${key}" argument must be an integer`)
187 }
188 if (value < 1) {
189 throw new RangeError(`The "${key}" argument must be >= 1`)
190 }
191 }
192 return value === undefined ? Infinity : value
193}
194
195function getItemCount (number) {
196 if (number === 1) {

Callers 1

configureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected