MCPcopy
hub / github.com/slevithan/xregexp / nullThrows

Function nullThrows

src/xregexp.js:347–354  ·  view source on GitHub ↗

* Returns the object, or throws an error if it is `null` or `undefined`. This is used to follow * the ES5 abstract operation `ToObject`. * * @private * @param {*} value Object to check and return. * @returns {*} The provided object.

(value)

Source from the content-addressed store, hash-verified

345 * @returns {*} The provided object.
346 */
347function nullThrows(value) {
348 // null or undefined
349 if (value == null) {
350 throw new TypeError('Cannot convert null or undefined to object');
351 }
352
353 return value;
354}
355
356/**
357 * Adds leading zeros if shorter than four characters. Used for fixed-length hexadecimal values.

Callers 1

xregexp.jsFile · 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…