Skip to content

Commit 13d6dd9

Browse files
committed
Added utility function Enumerable.Utils.recallFrom
1 parent 4d110fd commit 13d6dd9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

linq.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,31 @@
230230
}
231231
};
232232

233+
Enumerable.Utils.recallFrom = function (type) {
234+
var typeProto = type.prototype;
235+
var enumerableProto;
236+
237+
if (type === Array) {
238+
enumerableProto = ArrayEnumerable.prototype;
239+
delete typeProto.getSource;
240+
}
241+
else {
242+
enumerableProto = Enumerable.prototype;
243+
delete typeProto.getEnumerator;
244+
}
245+
246+
for (var methodName in enumerableProto) {
247+
var func = enumerableProto[methodName];
248+
249+
if (typeProto[methodName + 'ByLinq']) {
250+
delete typeProto[methodName + 'ByLinq'];
251+
}
252+
else if (typeProto[methodName] == func && func instanceof Function) {
253+
delete typeProto[methodName];
254+
}
255+
}
256+
};
257+
233258
// Generator
234259

235260
Enumerable.choice = function () // variable argument

0 commit comments

Comments
 (0)