jsduck 4.6.0 → 4.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -173,6 +173,7 @@ Katherine Chu,
173
173
  [vjetteam](https://github.com/vjetteam),
174
174
  [Chris Westbrook](https://github.com/cnstaging),
175
175
  [Scott Whittaker](https://github.com/scottrobertwhittaker),
176
+ [Timo Tijhof](https://github.com/Krinkle),
176
177
  and many-many others who reported bugs, submitted patches, and
177
178
  provided a lot of useful input.
178
179
 
data/Rakefile CHANGED
@@ -273,6 +273,10 @@ task :touch2 => :sass do
273
273
  "--output", OUT_DIR,
274
274
  "--config", "#{SDK_DIR}/touch/docs/config.json",
275
275
  "--examples-base-url", "touch-build/examples/production/",
276
+ # "--import", "Touch 1.1:../docs.sencha.com/exports/touch-1.1",
277
+ # "--import", "Touch 2.0:../docs.sencha.com/exports/touch-2.0.1",
278
+ # "--import", "Touch 2.1.0:../docs.sencha.com/exports/touch-2.1.0",
279
+ # "--import", "Touch 2.1.1",
276
280
  "--seo"
277
281
  )
278
282
 
data/js-classes/Array.js CHANGED
@@ -558,4 +558,497 @@
558
558
  * value or when an array is referred to in a string concatenation.
559
559
  *
560
560
  * @return {String} The array as a string.
561
- */
561
+ */
562
+
563
+ // ECMAScript 5 methods
564
+
565
+ /**
566
+ * @method isArray
567
+ * @static
568
+ * Returns true if an object is an array, false if it is not.
569
+ *
570
+ * // all following calls return true
571
+ * Array.isArray([]);
572
+ * Array.isArray([1]);
573
+ * Array.isArray( new Array() );
574
+ * Array.isArray( Array.prototype ); // Little known fact: Array.prototype itself is an array.
575
+ *
576
+ * // all following calls return false
577
+ * Array.isArray();
578
+ * Array.isArray({});
579
+ * Array.isArray(null);
580
+ * Array.isArray(undefined);
581
+ * Array.isArray(17);
582
+ * Array.isArray("Array");
583
+ * Array.isArray(true);
584
+ * Array.isArray(false);
585
+ * Array.isArray({ __proto__ : Array.prototype });
586
+ *
587
+ * **NOTE:** This method is part of the ECMAScript 5 standard.
588
+ *
589
+ * @param {Mixed} obj The object to be checked.
590
+ * @return {Boolean} True when Array.
591
+ */
592
+
593
+ /**
594
+ * @method indexOf
595
+ * Returns the first index at which a given element can be found in the array, or -1 if it is not present.
596
+ *
597
+ * `indexOf` compares `searchElement` to elements of the Array using strict equality (the same method used
598
+ * by the `===`, or triple-equals, operator).
599
+ *
600
+ * var array = [2, 5, 9];
601
+ * var index = array.indexOf(2);
602
+ * // index is 0
603
+ * index = array.indexOf(7);
604
+ * // index is -1
605
+ *
606
+ * **NOTE:** This method is part of the ECMAScript 5 standard.
607
+ *
608
+ * @param {Mixed} searchElement Element to locate in the array.
609
+ * @param {Number} [fromIndex] The index at which to begin the search. Defaults to 0, i.e. the whole array
610
+ * will be searched. If the index is greater than or equal to the length of the array, -1 is returned, i.e.
611
+ * the array will not be searched. If negative, it is taken as the offset from the end of the array. Note
612
+ * that even when the index is negative, the array is still searched from front to back. If the calculated
613
+ * index is less than 0, the whole array will be searched.
614
+ * @return {Number} The index of element found or -1.
615
+ */
616
+
617
+ /**
618
+ * @method lastIndexOf
619
+ * Returns the last index at which a given element can be found in the array, or -1 if it is not present.
620
+ * The array is searched backwards, starting at `fromIndex`.
621
+ *
622
+ * `lastIndexOf` compares `searchElement` to elements of the Array using strict equality (the same method
623
+ * used by the `===`, or triple-equals, operator).
624
+ *
625
+ * var array = [2, 5, 9, 2];
626
+ * var index = array.lastIndexOf(2);
627
+ * // index is 3
628
+ * index = array.lastIndexOf(7);
629
+ * // index is -1
630
+ * index = array.lastIndexOf(2, 3);
631
+ * // index is 3
632
+ * index = array.lastIndexOf(2, 2);
633
+ * // index is 0
634
+ * index = array.lastIndexOf(2, -2);
635
+ * // index is 0
636
+ * index = array.lastIndexOf(2, -1);
637
+ * // index is 3
638
+ *
639
+ * **NOTE:** This method is part of the ECMAScript 5 standard.
640
+ *
641
+ * @param {Mixed} searchElement Element to locate in the array.
642
+ * @param {Number} [fromIndex] The index at which to start searching backwards. Defaults to the array's
643
+ * length, i.e. the whole array will be searched. If the index is greater than or equal to the length of
644
+ * the array, the whole array will be searched. If negative, it is taken as the offset from the end of the
645
+ * array. Note that even when the index is negative, the array is still searched from back to front. If
646
+ * the calculated index is less than 0, -1 is returned, i.e. the array will not be searched.
647
+ * @return {Number} The index of element found or -1.
648
+ */
649
+
650
+ /**
651
+ * @method forEach
652
+ * Executes a provided function once per array element.
653
+ *
654
+ * `forEach` executes the provided function (`callback`) once for each element present in the array. `callback`
655
+ * is invoked only for indexes of the array which have assigned values; it is not invoked for indexes which
656
+ * have been deleted or which have never been assigned values.
657
+ *
658
+ * If a `thisArg` parameter is provided to `forEach`, it will be used as the `this` value for each `callback`
659
+ * invocation as if `callback.call(thisArg, element, index, array)` was called. If `thisArg` is `undefined` or
660
+ * `null`, the `this` value within the function depends on whether the function is in strict mode or not
661
+ * (passed value if in strict mode, global object if in non-strict mode).
662
+ *
663
+ * The `range` of elements processed by `forEach` is set before the first invocation of `callback`. Elements
664
+ * which are appended to the array after the call to `forEach` begins will not be visited by `callback`. If
665
+ * existing elements of the array are changed, or deleted, their value as passed to callback will be the
666
+ * value at the time `forEach` visits them; elements that are deleted are not visited.
667
+ *
668
+ * The following code logs a line for each element in an array:
669
+ *
670
+ * function logArrayElements(element, index, array) {
671
+ * console.log("a[" + index + "] = " + element);
672
+ * }
673
+ * [2, 5, 9].forEach(logArrayElements);
674
+ * // logs:
675
+ * // a[0] = 2
676
+ * // a[1] = 5
677
+ * // a[2] = 9
678
+ *
679
+ * **NOTE:** This method is part of the ECMAScript 5 standard.
680
+ *
681
+ * @param {Function} callback Function to execute for each element.
682
+ * @param {Mixed} callback.value The element value.
683
+ * @param {Number} callback.index The element index.
684
+ * @param {Array} callback.array The array being traversed.
685
+ * @param {Object} [thisArg] Object to use as `this` when executing `callback`.
686
+ */
687
+
688
+ /**
689
+ * @method every
690
+ * Tests whether all elements in the array pass the test implemented
691
+ * by the provided function.
692
+ *
693
+ * `every` executes the provided `callback` function once for each element
694
+ * present in the array until it finds one where `callback` returns a
695
+ * false value. If such an element is found, the `every` method
696
+ * immediately returns false. Otherwise, if `callback` returned a true
697
+ * value for all elements, `every` will return true. `callback` is invoked
698
+ * only for indexes of the array which have assigned values; it is not
699
+ * invoked for indexes which have been deleted or which have never
700
+ * been assigned values.
701
+ *
702
+ * If a `thisObject` parameter is provided to `every`, it will be used as
703
+ * the `this` for each invocation of the callback. If it is not
704
+ * provided, or is `null`, the global object associated with callback is
705
+ * used instead.
706
+ *
707
+ * `every` does not mutate the array on which it is called.
708
+ *
709
+ * The range of elements processed by `every` is set before the first
710
+ * invocation of callback. Elements which are appended to the array
711
+ * after the call to every begins will not be visited by `callback`. If
712
+ * existing elements of the array are changed, their value as passed
713
+ * to `callback` will be the value at the time `every` visits them;
714
+ * elements that are deleted are not visited.
715
+ *
716
+ * `every` acts like the "for all" quantifier in mathematics. In
717
+ * particular, for an empty array, it returns true. (It is vacuously
718
+ * true that all elements of the empty set satisfy any given
719
+ * condition.)
720
+ *
721
+ * The following example tests whether all elements in the array are
722
+ * bigger than 10.
723
+ *
724
+ * function isBigEnough(element, index, array) {
725
+ * return (element >= 10);
726
+ * }
727
+ * var passed = [12, 5, 8, 130, 44].every(isBigEnough);
728
+ * // passed is false
729
+ * passed = [12, 54, 18, 130, 44].every(isBigEnough);
730
+ * // passed is true
731
+ *
732
+ * **NOTE:** This method is part of the ECMAScript 5 standard.
733
+ *
734
+ * @param {Function} callback Function to test for each element.
735
+ * @param {Mixed} callback.value The element value.
736
+ * @param {Number} callback.index The element index.
737
+ * @param {Array} callback.array The array being traversed.
738
+ * @param {Boolean} callback.return Should return true when element passes the test.
739
+ * @param {Object} [thisObject] Object to use as `this` when executing `callback`.
740
+ * @return {Boolean} True when all elements pass the test.
741
+ */
742
+
743
+ /**
744
+ * @method some
745
+ * Tests whether some element in the array passes the test implemented
746
+ * by the provided function.
747
+ *
748
+ * `some` executes the `callback` function once for each element
749
+ * present in the array until it finds one where `callback` returns a
750
+ * true value. If such an element is found, some immediately returns
751
+ * true. Otherwise, some returns false. `callback` is invoked only for
752
+ * indexes of the array which have assigned values; it is not invoked
753
+ * for indexes which have been deleted or which have never been
754
+ * assigned values.
755
+ *
756
+ * If a `thisObject` parameter is provided to some, it will be used as
757
+ * the `this` for each invocation of the `callback`. If it is not
758
+ * provided, or is `null`, the global object associated with callback is
759
+ * used instead.
760
+ *
761
+ * `some` does not mutate the array on which it is called.
762
+ *
763
+ * The range of elements processed by `some` is set before the first
764
+ * invocation of callback. Elements that are appended to the array
765
+ * after the call to some begins will not be visited by `callback`. If
766
+ * an existing, unvisited element of the array is changed by `callback`,
767
+ * its value passed to the visiting callback will be the value at the
768
+ * time that `some` visits that element's index; elements that are
769
+ * deleted are not visited.
770
+ *
771
+ * The following example tests whether some element in the array is
772
+ * bigger than 10.
773
+ *
774
+ * function isBigEnough(element, index, array) {
775
+ * return (element >= 10);
776
+ * }
777
+ * var passed = [2, 5, 8, 1, 4].some(isBigEnough);
778
+ * // passed is false
779
+ * passed = [12, 5, 8, 1, 4].some(isBigEnough);
780
+ * // passed is true
781
+ *
782
+ * **NOTE:** This method is part of the ECMAScript 5 standard.
783
+ *
784
+ * @param {Function} callback Function to test for each element.
785
+ * @param {Mixed} callback.value The element value.
786
+ * @param {Number} callback.index The element index.
787
+ * @param {Array} callback.array The array being traversed.
788
+ * @param {Boolean} callback.return Should return true when element passes the test.
789
+ * @param {Object} [thisObject] Object to use as `this` when executing `callback`.
790
+ * @return {Boolean} True when at least one element passes the test.
791
+ */
792
+
793
+ /**
794
+ * @method filter
795
+ * Creates a new array with all elements that pass the test
796
+ * implemented by the provided function.
797
+ *
798
+ * `filter` calls a provided `callback` function once for each element in
799
+ * an array, and constructs a new array of all the values for which
800
+ * `callback` returns a true value. `callback` is invoked only for indexes
801
+ * of the array which have assigned values; it is not invoked for
802
+ * indexes which have been deleted or which have never been assigned
803
+ * values. Array elements which do not pass the `callback` test are
804
+ * simply skipped, and are not included in the new array.
805
+ *
806
+ * If a `thisObject` parameter is provided to `filter`, it will be
807
+ * used as the `this` for each invocation of the `callback`. If it is not
808
+ * provided, or is `null`, the global object associated with callback is
809
+ * used instead.
810
+ *
811
+ * `filter` does not mutate the array on which it is called.
812
+ *
813
+ * The range of elements processed by `filter` is set before the first
814
+ * invocation of `callback`. Elements which are appended to the array
815
+ * after the call to `filter` begins will not be visited by `callback`. If
816
+ * existing elements of the array are changed, or deleted, their value
817
+ * as passed to `callback` will be the value at the time `filter` visits
818
+ * them; elements that are deleted are not visited.
819
+ *
820
+ * The following example uses filter to create a filtered array that
821
+ * has all elements with values less than 10 removed.
822
+ *
823
+ * function isBigEnough(element, index, array) {
824
+ * return (element >= 10);
825
+ * }
826
+ * var filtered = [12, 5, 8, 130, 44].filter(isBigEnough);
827
+ * // filtered is [12, 130, 44]
828
+ *
829
+ * **NOTE:** This method is part of the ECMAScript 5 standard.
830
+ *
831
+ * @param {Function} callback Function to test for each element.
832
+ * @param {Mixed} callback.value The element value.
833
+ * @param {Number} callback.index The element index.
834
+ * @param {Array} callback.array The array being traversed.
835
+ * @param {Boolean} callback.return Should return true when element passes the test.
836
+ * @param {Object} [thisObject] Object to use as `this` when executing `callback`.
837
+ * @return {Array} Array of elements that passed the test.
838
+ */
839
+
840
+ /**
841
+ * @method map
842
+ * Creates a new array with the results of calling a provided function
843
+ * on every element in this array.
844
+ *
845
+ * `map` calls a provided `callback` function once for each element in
846
+ * an array, in order, and constructs a new array from the
847
+ * results. `callback` is invoked only for indexes of the array which
848
+ * have assigned values; it is not invoked for indexes which have been
849
+ * deleted or which have never been assigned values.
850
+ *
851
+ * If a `thisArg` parameter is provided to map, it will be used as the
852
+ * `this` for each invocation of the `callback`. If it is not provided, or
853
+ * is `null`, the global object associated with callback is used
854
+ * instead.
855
+ *
856
+ * `map` does not mutate the array on which it is called.
857
+ *
858
+ * The range of elements processed by `map` is set before the first
859
+ * invocation of `callback`. Elements which are appended to the array
860
+ * after the call to `map` begins will not be visited by `callback`. If
861
+ * existing elements of the array are changed, or deleted, their value
862
+ * as passed to `callback` will be the value at the time `map` visits
863
+ * them; elements that are deleted are not visited.
864
+ *
865
+ * The following code creates an array of "plural" forms of nouns from
866
+ * an array of their singular forms.
867
+ *
868
+ * function fuzzyPlural(single) {
869
+ * var result = single.replace(/o/g, 'e');
870
+ * if( single === 'kangaroo'){
871
+ * result += 'se';
872
+ * }
873
+ * return result;
874
+ * }
875
+ *
876
+ * var words = ["foot", "goose", "moose", "kangaroo"];
877
+ * console.log(words.map(fuzzyPlural));
878
+ *
879
+ * // ["feet", "geese", "meese", "kangareese"]
880
+ *
881
+ * The following code takes an array of numbers and creates a new
882
+ * array containing the square roots of the numbers in the first
883
+ * array.
884
+ *
885
+ * var numbers = [1, 4, 9];
886
+ * var roots = numbers.map(Math.sqrt);
887
+ * // roots is now [1, 2, 3], numbers is still [1, 4, 9]
888
+ *
889
+ * **NOTE:** This method is part of the ECMAScript 5 standard.
890
+ *
891
+ * @param {Function} callback Function that produces an element of the new Array
892
+ * from an element of the current one.
893
+ * @param {Mixed} callback.value The element value.
894
+ * @param {Number} callback.index The element index.
895
+ * @param {Array} callback.array The array being traversed.
896
+ * @param {Boolean} callback.return Should return true when element passes the test.
897
+ * @param {Object} [thisObject] Object to use as `this` when executing `callback`.
898
+ * @return {Array} Array of the return values of `callback` function.
899
+ */
900
+
901
+ /**
902
+ * @method reduce
903
+ * Applies a function against an accumulator and each value of the
904
+ * array (from left-to-right) as to reduce it to a single value.
905
+ *
906
+ * `reduce` executes the `callback` function once for each element
907
+ * present in the array, excluding holes in the array.
908
+ *
909
+ * The first time the `callback` is called, `previousValue` and
910
+ * `currentValue` can be one of two values. If `initialValue` is
911
+ * provided in the call to `reduce`, then `previousValue` will be equal to
912
+ * `initialValue` and `currentValue` will be equal to the first value in
913
+ * the array. If no `initialValue` was provided, then `previousValue` will
914
+ * be equal to the first value in the array and `currentValue` will be
915
+ * equal to the second.
916
+ *
917
+ * Suppose the following use of reduce occurred:
918
+ *
919
+ * [0,1,2,3,4].reduce(function(previousValue, currentValue, index, array){
920
+ * return previousValue + currentValue;
921
+ * });
922
+ *
923
+ * The callback would be invoked four times, with the arguments and
924
+ * return values in each call being as follows:
925
+ *
926
+ * | | previousValue | currentValue | index | array | return value
927
+ * |:------------|:--------------|:-------------|:------|:------------|:------------
928
+ * | first call | 0 | 1 | 1 | [0,1,2,3,4] | 1
929
+ * | second call | 1 | 2 | 2 | [0,1,2,3,4] | 3
930
+ * | third call | 3 | 3 | 3 | [0,1,2,3,4] | 6
931
+ * | fourth call | 6 | 4 | 4 | [0,1,2,3,4] | 10
932
+ *
933
+ * The value returned by `reduce` would be that of the last callback
934
+ * invocation (10).
935
+ *
936
+ * If you were to provide an initial value as the second argument to
937
+ * reduce, the result would look like this:
938
+ *
939
+ * [0,1,2,3,4].reduce(function(previousValue, currentValue, index, array){
940
+ * return previousValue + currentValue;
941
+ * }, 10);
942
+ *
943
+ * | | previousValue | currentValue | index | array | return value
944
+ * |:------------|:--------------|:-------------|:------|:------------|:------------
945
+ * | first call | 10 | 0 | 0 | [0,1,2,3,4] | 10
946
+ * | second call | 10 | 1 | 1 | [0,1,2,3,4] | 11
947
+ * | third call | 11 | 2 | 2 | [0,1,2,3,4] | 13
948
+ * | fourth call | 13 | 3 | 3 | [0,1,2,3,4] | 16
949
+ * | fifth call | 16 | 4 | 4 | [0,1,2,3,4] | 20
950
+ *
951
+ * The value returned by `reduce` this time would be, of course, 20.
952
+ *
953
+ * Example: Sum up all values within an array:
954
+ *
955
+ * var total = [0, 1, 2, 3].reduce(function(a, b) {
956
+ * return a + b;
957
+ * });
958
+ * // total == 6
959
+ *
960
+ * Example: Flatten an array of arrays:
961
+ *
962
+ * var flattened = [[0, 1], [2, 3], [4, 5]].reduce(function(a, b) {
963
+ * return a.concat(b);
964
+ * });
965
+ * // flattened is [0, 1, 2, 3, 4, 5]
966
+ *
967
+ * **NOTE:** This method is part of the ECMAScript 5 standard.
968
+ *
969
+ * @param {Function} callback Function to execute on each value in the array.
970
+ * @param {Mixed} callback.previousValue The value previously returned in the last
971
+ * invocation of the `callback`, or `initialValue`, if supplied.
972
+ * @param {Mixed} callback.currentValue The current element being processed in the array.
973
+ * @param {Number} callback.index The index of the current element being processed in the array.
974
+ * @param {Array} callback.array The array `reduce` was called upon.
975
+ * @param {Mixed} [initialValue] Object to use as the first argument to the first call
976
+ * of the `callback`.
977
+ * @return {Mixed} The value returned by final invocation of the `callback`.
978
+ */
979
+
980
+ /**
981
+ * @method reduceRight
982
+ * Applies a function simultaneously against two values of the array
983
+ * (from right-to-left) as to reduce it to a single value.
984
+ *
985
+ * `reduceRight` executes the `callback` function once for each
986
+ * element present in the array, excluding holes in the array.
987
+ *
988
+ * The first time the `callback` is called, `previousValue` and
989
+ * `currentValue` can be one of two values. If `initialValue` is
990
+ * provided in the call to `reduceRight`, then `previousValue` will be equal to
991
+ * `initialValue` and `currentValue` will be equal to the last value in
992
+ * the array. If no `initialValue` was provided, then `previousValue` will
993
+ * be equal to the last value in the array and `currentValue` will be
994
+ * equal to the second-to-last value.
995
+ *
996
+ * Some example run-throughs of the function would look like this:
997
+ *
998
+ * [0, 1, 2, 3, 4].reduceRight(function(previousValue, currentValue, index, array) {
999
+ * return previousValue + currentValue;
1000
+ * });
1001
+ *
1002
+ * // First call
1003
+ * previousValue = 4, currentValue = 3, index = 3
1004
+ *
1005
+ * // Second call
1006
+ * previousValue = 7, currentValue = 2, index = 2
1007
+ *
1008
+ * // Third call
1009
+ * previousValue = 9, currentValue = 1, index = 1
1010
+ *
1011
+ * // Fourth call
1012
+ * previousValue = 10, currentValue = 0, index = 0
1013
+ *
1014
+ * // array is always the object [0,1,2,3,4] upon which reduceRight was called
1015
+ *
1016
+ * // Return Value: 10
1017
+ *
1018
+ * And if you were to provide an initialValue, the result would look like this:
1019
+ *
1020
+ * [0, 1, 2, 3, 4].reduceRight(function(previousValue, currentValue, index, array) {
1021
+ * return previousValue + currentValue;
1022
+ * }, 10);
1023
+ *
1024
+ * // First call
1025
+ * previousValue = 10, currentValue = 4, index = 4
1026
+ *
1027
+ * // Second call
1028
+ * previousValue = 14, currentValue = 3, index = 3
1029
+ *
1030
+ * // Third call
1031
+ * previousValue = 17, currentValue = 2, index = 2
1032
+ *
1033
+ * // Fourth call
1034
+ * previousValue = 19, currentValue = 1, index = 1
1035
+ *
1036
+ * // Fifth call
1037
+ * previousValue = 20, currentValue = 0, index = 0
1038
+ *
1039
+ * // array is always the object [0,1,2,3,4] upon which reduceRight was called
1040
+ *
1041
+ * // Return Value: 20
1042
+ *
1043
+ * **NOTE:** This method is part of the ECMAScript 5 standard.
1044
+ *
1045
+ * @param {Function} callback Function to execute on each value in the array.
1046
+ * @param {Mixed} callback.previousValue The value previously returned in the last
1047
+ * invocation of the `callback`, or `initialValue`, if supplied.
1048
+ * @param {Mixed} callback.currentValue The current element being processed in the array.
1049
+ * @param {Number} callback.index The index of the current element being processed in the array.
1050
+ * @param {Array} callback.array The array `reduceRight` was called upon.
1051
+ * @param {Mixed} [initialValue] Object to use as the first argument to the first call
1052
+ * of the `callback`.
1053
+ * @return {Mixed} The value returned by final invocation of the `callback`.
1054
+ */