All Downloads are FREE. Search and download functionalities are using the official Maven repository.

node_modules.graceful-fs.fs.js Maven / Gradle / Ivy

There is a newer version: 1.1.2
Show newest version
'use strict'

var fs = require('fs')

module.exports = clone(fs)

function clone (obj) {
  if (obj === null || typeof obj !== 'object')
    return obj

  if (obj instanceof Object)
    var copy = { __proto__: obj.__proto__ }
  else
    var copy = Object.create(null)

  Object.getOwnPropertyNames(obj).forEach(function (key) {
    Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
  })

  return copy
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy