@@ -411,6 +411,12 @@ Array.from = $A;
411411 * or `-1` if `item` doesn't exist in the array. `Array#indexOf` compares
412412 * items using *strict equality* (`===`).
413413 *
414+ * `Array#indexOf` acts as an ECMAScript 5 [polyfill](http://remysharp.com/2010/10/08/what-is-a-polyfill/).
415+ * It is only defined if not already present in the user's browser, and it
416+ * is meant to behave like the native version as much as possible. Consult
417+ * the [ES5 specification](http://es5.github.com/#x15.4.4.14) for more
418+ * information.
419+ *
414420 * ##### Examples
415421 *
416422 * [3, 5, 6, 1, 20].indexOf(1)
@@ -460,6 +466,12 @@ Array.from = $A;
460466 *
461467 * Returns the position of the last occurrence of `item` within the
462468 * array — or `-1` if `item` doesn't exist in the array.
469+ *
470+ * `Array#lastIndexOf` acts as an ECMAScript 5 [polyfill](http://remysharp.com/2010/10/08/what-is-a-polyfill/).
471+ * It is only defined if not already present in the user's browser, and it
472+ * is meant to behave like the native version as much as possible. Consult
473+ * the [ES5 specification](http://es5.github.com/#x15.4.4.15) for more
474+ * information.
463475 **/
464476 function lastIndexOf ( item , i ) {
465477 if ( this == null ) throw new TypeError ( ) ;
@@ -529,6 +541,7 @@ Array.from = $A;
529541 // methods with our own behavior. This has very little performance impact.
530542 // It violates the spec by suppressing `TypeError`s for certain methods,
531543 // but that's an acceptable trade-off.
544+
532545 function wrapNative ( method ) {
533546 return function ( ) {
534547 if ( arguments . length === 0 ) {
@@ -554,6 +567,24 @@ Array.from = $A;
554567 //
555568 // This means that they behave a little differently from other methods in
556569 // `Enumerable`/`Array` that don't collide with ES5, but that's OK.
570+
571+ /**
572+ * Array#map([iterator = Prototype.K[, context]]) -> Array
573+ * - iterator (Function): The iterator function to apply to each element
574+ * in the enumeration.
575+ * - context (Object): An optional object to use as `this` within
576+ * calls to the iterator.
577+ *
578+ * Returns the result of applying `iterator` to each item in the array. If
579+ * no iterator is provided, the elements are simply copied to the returned
580+ * array.
581+ *
582+ * `Array#map` acts as an ECMAScript 5 [polyfill](http://remysharp.com/2010/10/08/what-is-a-polyfill/).
583+ * It is only defined if not already present in the user's browser, and it
584+ * is meant to behave like the native version as much as possible. Consult
585+ * the [ES5 specification](http://es5.github.com/#x15.4.4.19) for more
586+ * information.
587+ **/
557588 function map ( iterator ) {
558589 if ( this == null ) throw new TypeError ( ) ;
559590 iterator = iterator || Prototype . K ;
@@ -575,6 +606,22 @@ Array.from = $A;
575606 map = wrapNative ( Array . prototype . map ) ;
576607 }
577608
609+ /**
610+ * Array#filter(iterator[, context]) -> Array
611+ * - iterator (Function): An iterator function to use to test the
612+ * elements.
613+ * - context (Object): An optional object to use as `this` within
614+ * calls to the iterator.
615+ *
616+ * Returns a new array containing all the items in this array for which
617+ * `iterator` returned a truthy value.
618+ *
619+ * `Array#filter` acts as an ECMAScript 5 [polyfill](http://remysharp.com/2010/10/08/what-is-a-polyfill/).
620+ * It is only defined if not already present in the user's browser, and it
621+ * is meant to behave like the native version as much as possible. Consult
622+ * the [ES5 specification](http://es5.github.com/#x15.4.4.20) for more
623+ * information.
624+ **/
578625 function filter ( iterator ) {
579626 if ( this == null || ! Object . isFunction ( iterator ) )
580627 throw new TypeError ( ) ;
@@ -599,6 +646,24 @@ Array.from = $A;
599646 filter = Array . prototype . filter ;
600647 }
601648
649+ /**
650+ * Array#some([iterator = Prototype.K[, context]]) -> Array
651+ * - iterator (Function): An optional function to use to evaluate each
652+ * element in the enumeration; the function should return the value to
653+ * test. If this is not provided, the element itself is tested.
654+ * - context (Object): An optional object to use as `this` within
655+ * calls to the iterator.
656+ *
657+ * Returns the result of applying `iterator` to each item in the array. If
658+ * no iterator is provided, the elements are simply copied to the returned
659+ * array.
660+ *
661+ * `Array#some` acts as an ECMAScript 5 [polyfill](http://remysharp.com/2010/10/08/what-is-a-polyfill/).
662+ * It is only defined if not already present in the user's browser, and it
663+ * is meant to behave like the native version as much as possible. Consult
664+ * the [ES5 specification](http://es5.github.com/#x15.4.4.17) for more
665+ * information.
666+ **/
602667 function some ( iterator ) {
603668 if ( this == null ) throw new TypeError ( ) ;
604669 iterator = iterator || Prototype . K ;
@@ -618,6 +683,25 @@ Array.from = $A;
618683 var some = wrapNative ( Array . prototype . some ) ;
619684 }
620685
686+
687+ /**
688+ * Array#every([iterator = Prototype.K[, context]]) -> Boolean
689+ * - iterator (Function): An optional function to use to evaluate each
690+ * element in the enumeration; the function should return the value to
691+ * test. If this is not provided, the element itself is tested.
692+ * - context (Object): An optional object to use as `this` within
693+ * calls to the iterator.
694+ *
695+ * Determines whether at least one element is truthy (boolean-equivalent to
696+ * `true`), either directly or through computation by the provided iterator.
697+ *
698+ * `Array#every` acts as an ECMAScript 5 [polyfill](http://remysharp.com/2010/10/08/what-is-a-polyfill/).
699+ * It is only defined if not already present in the user's browser, and it
700+ * is meant to behave like the native version as much as possible. Consult
701+ * the [ES5 specification](http://es5.github.com/#x15.4.4.16) for more
702+ * information.
703+ *
704+ **/
621705 function every ( iterator ) {
622706 if ( this == null ) throw new TypeError ( ) ;
623707 iterator = iterator || Prototype . K ;
0 commit comments