mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-26 22:59:27 +08:00
Add node modules and compiled JavaScript from main (#172)
Co-authored-by: Oliver King <oking3@uncc.edu>
This commit is contained in:
committed by
GitHub
parent
ee3c5aed75
commit
08d466b6ab
+34
@@ -0,0 +1,34 @@
|
||||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
function withoutProperty(object, property, fn) {
|
||||
var original;
|
||||
if (Object.getOwnPropertyDescriptor) {
|
||||
original = Object.getOwnPropertyDescriptor(object, property);
|
||||
} else {
|
||||
original = object[property];
|
||||
}
|
||||
delete object[property];
|
||||
try {
|
||||
fn();
|
||||
} finally {
|
||||
if (Object.getOwnPropertyDescriptor) {
|
||||
Object.defineProperty(object, property, original);
|
||||
} else {
|
||||
object[property] = original;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test('when Object#hasOwnProperty is deleted', function (t) {
|
||||
t.plan(1);
|
||||
var arr = [1, , 3]; // eslint-disable-line no-sparse-arrays
|
||||
|
||||
// eslint-disable-next-line no-extend-native
|
||||
Array.prototype[1] = 2; // this is needed to account for "in" vs "hasOwnProperty"
|
||||
|
||||
withoutProperty(Object.prototype, 'hasOwnProperty', function () {
|
||||
t.equal(inspect(arr), '[ 1, , 3 ]');
|
||||
});
|
||||
delete Array.prototype[1];
|
||||
});
|
||||
Reference in New Issue
Block a user