source: imaps-frontend/node_modules/graceful-fs/clone.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 496 bytes
RevLine 
[79a0317]1'use strict'
2
3module.exports = clone
4
5var getPrototypeOf = Object.getPrototypeOf || function (obj) {
6 return obj.__proto__
7}
8
9function clone (obj) {
10 if (obj === null || typeof obj !== 'object')
11 return obj
12
13 if (obj instanceof Object)
14 var copy = { __proto__: getPrototypeOf(obj) }
15 else
16 var copy = Object.create(null)
17
18 Object.getOwnPropertyNames(obj).forEach(function (key) {
19 Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
20 })
21
22 return copy
23}
Note: See TracBrowser for help on using the repository browser.