multiplex.js
multiplex.js copied to clipboard
Add `asEnumerable()` extension to Array and String prototype
// TODO: Set with Object define property, and set 'enumerable: false'
String.prototype.asEnumerable = function () {
return mx(this);
};
Array.prototype.asEnumerable = function () {
return mx(this);
};
Typescript definition:
interface String {
asEnumerable(): mx.Enumerable<String>;
}
interface Array<T> {
asEnumerable(): mx.Enumerable<T>;
}
The definition can only extend the built-in types if the definition is global, not a module. But in the current situation, that is the case.