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

Function getCircularValueOption

index.js:120–139  ·  view source on GitHub ↗

@param {Record } options

(options)

Source from the content-addressed store, hash-verified

118
119/** @param {Record<string, unknown>} options */
120function getCircularValueOption (options) {
121 if (hasOwnProperty.call(options, 'circularValue')) {
122 const circularValue = options.circularValue
123 if (typeof circularValue === 'string') {
124 return `"${circularValue}"`
125 }
126 if (circularValue == null) {
127 return circularValue
128 }
129 if (circularValue === Error || circularValue === TypeError) {
130 return {
131 toString () {
132 throw new TypeError('Converting circular structure to JSON')
133 }
134 }
135 }
136 throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')
137 }
138 return stringifyCircularDepth
139}
140
141function getDeterministicOption (options) {
142 let value

Callers 1

configureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected