Comparing version 0.4.1 to 0.4.2
53
index.js
@@ -7,39 +7,44 @@ /* | ||
var hasOwn = require("mout/object/hasOwn"), | ||
forIn = require("mout/object/forIn"), | ||
mixIn = require("mout/object/mixIn"), | ||
filter = require("mout/object/filter"), | ||
create = require("mout/lang/createObject"), | ||
kindOf = require("mout/lang/kindOf") | ||
var defineProperty = Object.defineProperty, | ||
getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor | ||
var hasDescriptors = true | ||
try { | ||
defineProperty({}, "~", {}) | ||
getOwnPropertyDescriptor({}, "~") | ||
Object.defineProperty({}, "~", {}) | ||
Object.getOwnPropertyDescriptor({}, "~") | ||
} catch (e){ | ||
defineProperty = null | ||
getOwnPropertyDescriptor = null | ||
hasDescriptors = false | ||
} | ||
var define = function(value, key, from){ | ||
defineProperty(this, key, getOwnPropertyDescriptor(from, key) || { | ||
writable: true, | ||
enumerable: true, | ||
configurable: true, | ||
value: value | ||
}) | ||
} | ||
// we only need to be able to implement "toString" and "valueOf" in IE < 9 | ||
var hasEnumBug = !({valueOf: 0}).propertyIsEnumerable("valueOf"), | ||
buggy = ["toString", "valueOf"] | ||
var copy = function(value, key){ | ||
this[key] = value | ||
} | ||
var verbs = /^constructor|inherits|mixin$/ | ||
var implement = function(proto){ | ||
forIn(proto, defineProperty ? define : copy, this.prototype) | ||
var prototype = this.prototype | ||
for (var key in proto){ | ||
if (key.match(verbs)) continue | ||
if (hasDescriptors){ | ||
var descriptor = Object.getOwnPropertyDescriptor(proto, key) | ||
if (descriptor){ | ||
Object.defineProperty(prototype, key, descriptor) | ||
continue | ||
} | ||
} | ||
prototype[key] = proto[key] | ||
} | ||
if (hasEnumBug) for (var i = 0; (key = buggy[i]); i++){ | ||
var value = proto[key] | ||
if (value !== Object.prototype[key]) prototype[key] = value | ||
} | ||
return this | ||
} | ||
var verbs = /^constructor|inherits|mixin$/ | ||
var prime = function(proto){ | ||
@@ -82,5 +87,3 @@ | ||
// implement proto and return constructor | ||
return constructor.implement(filter(proto, function(value, key){ | ||
return !key.match(verbs) | ||
})) | ||
return constructor.implement(proto) | ||
@@ -87,0 +90,0 @@ } |
{ | ||
"name": "prime", | ||
"homepage": "https://github.com/mootools/prime", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"main": "./index.js", | ||
@@ -6,0 +6,0 @@ "description": "prime, an OOP JavaScript library for node and the web.", |
@@ -0,1 +1,3 @@ | ||
# ![prime](http://kamicane.github.io/assets/prime.png) | ||
[![Package Info](http://img.shields.io/badge/npm-prime-blue.svg)](https://npmjs.org/package/prime) | ||
@@ -9,4 +11,2 @@ [![NPM Version](http://img.shields.io/npm/v/prime.svg)](https://npmjs.org/package/prime) | ||
#prime |prīm| | ||
1. fundamental, basic, essential. | ||
@@ -108,1 +108,3 @@ 2. make (something) ready for use or action. | ||
``` | ||
When all else fails, read the [full documentation](https://github.com/kamicane/prime/blob/master/doc/prime.md). |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
248904
24
2289
109
1