mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-13 12:27:49 +00:00
Remove more native trim test scaffolding .
This commit is contained in:
@@ -74,15 +74,6 @@
|
|||||||
setProperty(String.prototype, '_contains', String.prototype.contains);
|
setProperty(String.prototype, '_contains', String.prototype.contains);
|
||||||
setProperty(String.prototype, 'contains', String.prototype._contains ? function() {} : Boolean);
|
setProperty(String.prototype, 'contains', String.prototype._contains ? function() {} : Boolean);
|
||||||
|
|
||||||
setProperty(String.prototype, '_trim', String.prototype.trim);
|
|
||||||
setProperty(String.prototype, 'trim', String.prototype._trim ? function() {} : String);
|
|
||||||
|
|
||||||
setProperty(String.prototype, '_trimLeft', String.prototype.trimLeft);
|
|
||||||
setProperty(String.prototype, 'trimLeft', String.prototype._trimLeft ? function() {} : String);
|
|
||||||
|
|
||||||
setProperty(String.prototype, '_trimRight', String.prototype.trimRight);
|
|
||||||
setProperty(String.prototype, 'trimRight', String.prototype._trimRight ? function() {} : String);
|
|
||||||
|
|
||||||
setProperty(window, 'WinRTError', Error);
|
setProperty(window, 'WinRTError', Error);
|
||||||
|
|
||||||
setProperty(document, '_createDocumentFragment', document.createDocumentFragment);
|
setProperty(document, '_createDocumentFragment', document.createDocumentFragment);
|
||||||
@@ -120,19 +111,10 @@
|
|||||||
} else {
|
} else {
|
||||||
delete Object.keys;
|
delete Object.keys;
|
||||||
}
|
}
|
||||||
for (var key in {
|
if (String.prototype._contains) {
|
||||||
'contains': true,
|
setProperty(String.prototype, 'contains', String.prototype._contains);
|
||||||
'trim': true,
|
} else {
|
||||||
'trimLeft': true,
|
delete String.prototype.contains;
|
||||||
'trimRight': true
|
|
||||||
}) {
|
|
||||||
var func = String.prototype['_' + key];
|
|
||||||
if (func) {
|
|
||||||
setProperty(String.prototype, key, func);
|
|
||||||
} else {
|
|
||||||
delete String.prototype[key];
|
|
||||||
}
|
|
||||||
delete String.prototype['_' + key];
|
|
||||||
}
|
}
|
||||||
setProperty(window, 'WinRTError', undefined);
|
setProperty(window, 'WinRTError', undefined);
|
||||||
setProperty(Function.prototype, 'toString', Function.prototype._toString);
|
setProperty(Function.prototype, 'toString', Function.prototype._toString);
|
||||||
@@ -148,6 +130,7 @@
|
|||||||
delete Object._defineProperty;
|
delete Object._defineProperty;
|
||||||
delete Object._getPrototypeOf;
|
delete Object._getPrototypeOf;
|
||||||
delete Object._keys;
|
delete Object._keys;
|
||||||
|
delete String.prototype._contains;
|
||||||
}
|
}
|
||||||
|
|
||||||
// load Lo-Dash and expose it to the bad extensions/shims
|
// load Lo-Dash and expose it to the bad extensions/shims
|
||||||
|
|||||||
28
test/test.js
28
test/test.js
@@ -341,15 +341,6 @@
|
|||||||
var _contains = String.prototype.contains;
|
var _contains = String.prototype.contains;
|
||||||
setProperty(String.prototype, 'contains', _contains ? function() {} : Boolean);
|
setProperty(String.prototype, 'contains', _contains ? function() {} : Boolean);
|
||||||
|
|
||||||
var _trim = String.prototype.trim;
|
|
||||||
setProperty(String.prototype, 'trim', _trim ? function() {} : String);
|
|
||||||
|
|
||||||
var _trimLeft = String.prototype.trimLeft;
|
|
||||||
setProperty(String.prototype, 'trimLeft', _trimLeft ? function() {} : String);
|
|
||||||
|
|
||||||
var _trimRight = String.prototype.trimRight;
|
|
||||||
setProperty(String.prototype, 'trimRight', _trimRight ? function() {} : String);
|
|
||||||
|
|
||||||
// clear cache so Lo-Dash can be reloaded
|
// clear cache so Lo-Dash can be reloaded
|
||||||
emptyObject(require.cache);
|
emptyObject(require.cache);
|
||||||
|
|
||||||
@@ -365,20 +356,11 @@
|
|||||||
setProperty(Object, 'keys', _keys);
|
setProperty(Object, 'keys', _keys);
|
||||||
setProperty(Function.prototype, 'toString', _fnToString);
|
setProperty(Function.prototype, 'toString', _fnToString);
|
||||||
|
|
||||||
_.forOwn({
|
if (_contains) {
|
||||||
'contains': _contains,
|
setProperty(String.prototype, 'contains', _contains);
|
||||||
'trim': _trim,
|
} else {
|
||||||
'trimLeft': _trimLeft,
|
delete String.prototype.contains;
|
||||||
'trimRight': _trimRight
|
}
|
||||||
},
|
|
||||||
function(func, key) {
|
|
||||||
if (func) {
|
|
||||||
setProperty(String.prototype, key, func);
|
|
||||||
} else {
|
|
||||||
delete String.prototype[key];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
delete global.window;
|
delete global.window;
|
||||||
delete global.WinRTError;
|
delete global.WinRTError;
|
||||||
delete Function.prototype._method;
|
delete Function.prototype._method;
|
||||||
|
|||||||
Reference in New Issue
Block a user