PHP 8.2.30
Preview: stringify.js Size: 907 B
//lib/node_modules/npm/node_modules/json-stringify-safe/stringify.js

exports = module.exports = stringify
exports.getSerialize = serializer

function stringify(obj, replacer, spaces, cycleReplacer) {
  return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces)
}

function serializer(replacer, cycleReplacer) {
  var stack = [], keys = []

  if (cycleReplacer == null) cycleReplacer = function(key, value) {
    if (stack[0] === value) return "[Circular ~]"
    return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"
  }

  return function(key, value) {
    if (stack.length > 0) {
      var thisPos = stack.indexOf(this)
      ~thisPos ? stack.splice(thisPos + 1) : stack.push(this)
      ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key)
      if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value)
    }
    else stack.push(value)

    return replacer == null ? value : replacer.call(this, key, value)
  }
}

Directory Contents

Dirs: 0 × Files: 7

Name Size Perms Modified Actions
7 B lrw-r--r-- 2021-03-10 14:36:40
Edit Download
734 B lrw-r--r-- 2021-03-10 14:36:40
Edit Download
765 B lrw-r--r-- 2021-03-10 14:36:40
Edit Download
675 B lrw-r--r-- 2021-03-10 14:36:40
Edit Download
1.70 KB lrw-r--r-- 2021-03-10 14:36:40
Edit Download
1.23 KB lrw-r--r-- 2021-03-10 14:36:40
Edit Download
907 B lrw-r--r-- 2021-03-10 14:36:40
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).