Initial commit
[yaffs-website] / node_modules / path-type / node_modules / graceful-fs / fs.js
1 'use strict'
2
3 var fs = require('fs')
4
5 module.exports = clone(fs)
6
7 function clone (obj) {
8   if (obj === null || typeof obj !== 'object')
9     return obj
10
11   if (obj instanceof Object)
12     var copy = { __proto__: obj.__proto__ }
13   else
14     var copy = Object.create(null)
15
16   Object.getOwnPropertyNames(obj).forEach(function (key) {
17     Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
18   })
19
20   return copy
21 }