multiplex.js icon indicating copy to clipboard operation
multiplex.js copied to clipboard

Add `asEnumerable()` extension to Array and String prototype

Open patroza opened this issue 8 years ago • 0 comments

// 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.

patroza avatar Jun 25 '17 08:06 patroza