"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/graceful-fs/fs.js" (7 Feb 2017, 429 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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 }