1 //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
2 //>>description: Makes array with given range
4 //>>group: Tizen:Utilities
6 define( [ ], function ( ) {
7 //>>excludeEnd("jqmBuildExclude");
10 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL licenses
11 * http://phpjs.org/functions/range
12 * original by: Waldo Malqui Silva
15 function range( low, high, step ) {
16 // Create an array containing the range of integers or characters
17 // from low to high (inclusive)
20 // discuss at: http://phpjs.org/functions/range
21 // + original by: Waldo Malqui Silva
22 // * example 1: range ( 0, 12 );
23 // * returns 1: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
24 // * example 2: range( 0, 100, 10 );
25 // * returns 2: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
26 // * example 3: range( 'a', 'i' );
27 // * returns 3: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
28 // * example 4: range( 'c', 'a' );
29 // * returns 4: ['c', 'b', 'a']
37 if (!isNaN(low) && !isNaN(high)) {
40 } else if (isNaN(low) && isNaN(high)) {
42 inival = low.charCodeAt(0);
43 endval = high.charCodeAt(0);
45 inival = (isNaN(low) ? 0 : low);
46 endval = (isNaN(high) ? 0 : high);
49 plus = ((inival > endval) ? false : true);
51 while (inival <= endval) {
52 matrix.push(((chars) ? String.fromCharCode(inival) : inival));
56 while (inival >= endval) {
57 matrix.push(((chars) ? String.fromCharCode(inival) : inival));
65 //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
67 //>>excludeEnd("jqmBuildExclude");