prototypes
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -21,2 +21,3 @@ 'use strict'; | ||
value: extension[key], | ||
writable: true, | ||
}); | ||
@@ -29,3 +30,3 @@ } | ||
*/ | ||
function testProperties(callback) | ||
function testEnumerateProperties(callback) | ||
{ | ||
@@ -45,2 +46,26 @@ var first = {}; | ||
/** | ||
* Test that the new properties can be overwritten. | ||
*/ | ||
function testOverwriteProperties(callback) | ||
{ | ||
var newObject = { | ||
one: function() | ||
{ | ||
return 0; | ||
}, | ||
}; | ||
var object = { | ||
a: 'a', | ||
}; | ||
exports.addProperties(Object.prototype, newObject); | ||
testing.assertEquals(object.one(), 0, 'Property not set', callback); | ||
object.one = function() | ||
{ | ||
return 1; | ||
}; | ||
testing.assertEquals(object.one(), 1, 'Property not overwritten', callback); | ||
testing.success(callback); | ||
} | ||
/** | ||
* Run package tests. | ||
@@ -51,3 +76,4 @@ */ | ||
var tests = { | ||
testProperties: testProperties, | ||
enumerateProperties: testEnumerateProperties, | ||
overwrite: testOverwriteProperties, | ||
}; | ||
@@ -54,0 +80,0 @@ testing.run(tests, callback); |
{ | ||
"name": "prototypes", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Some common prototypes for node.js: string.startsWith(), object.countProperties() and more. Functions are added using Object.defineProperty() to avoid polluting new objects.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/alexfernandez/prototypes", |
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
20267
551