classified-magic
Advanced tools
Comparing version 0.1.3 to 0.1.4
37
magic.js
var classified = require('classified'), | ||
separator = require('path').sep, | ||
proxy = Proxy; | ||
separator = require('path').sep; | ||
/*jshint -W079 */ | ||
if(typeof Proxy === 'undefined') { | ||
var Proxy = require('node-proxified'); | ||
} | ||
/* Definition | ||
@@ -186,4 +180,26 @@ -------------------------------*/ | ||
// check if native Proxy is enabled | ||
if(typeof Proxy === 'undefined') { | ||
throw new Error( | ||
'Must have at least native proxy support by running ' + | ||
'`node --harmony` or node -- harmony-proxies, or if ' + | ||
'using mocha run `mocha --harmony test`'); | ||
} | ||
var magic = {}; | ||
magic.getOwnPropertyDescriptor = function(name) { | ||
if(typeof instance.getOwnPropertyDescriptor === 'function') { | ||
return instance.getOwnPropertyDescriptor(instance, name); | ||
} | ||
var descriptor = Object.getOwnPropertyDescriptor(instance, name); | ||
if(typeof descriptor !== 'undefined') { | ||
desciptor.configurable = true; | ||
} | ||
return descriptor; | ||
}; | ||
magic.get = function(receiver, name) { | ||
@@ -242,3 +258,8 @@ //if it exists | ||
return Proxy(magic, instance); | ||
// check support for new Proxy | ||
if(typeof Proxy === 'object') { | ||
return Proxy.create(magic, instance); | ||
} | ||
return new Proxy(instance, magic); | ||
}; | ||
@@ -245,0 +266,0 @@ |
{ | ||
"name": "classified-magic", | ||
"description": "OOP for NodeJS with magic", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"author": { | ||
@@ -25,4 +25,3 @@ "name": "Christian Blanquera", | ||
"dependencies": { | ||
"classified": "0.1.2" , | ||
"node-proxified": "0.0.2" | ||
"classified": "0.1.2" | ||
}, | ||
@@ -29,0 +28,0 @@ "main": "./magic.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19295
1
438
- Removednode-proxified@0.0.2
- Removednode-proxified@0.0.2(transitive)