Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c82fc5
commit d9d2943
Showing
73 changed files
with
627 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* @description | ||
* Move an array element to the right | ||
* | ||
* @example moveLeft([1,2,3,4,5]); // [5,1,2,3,4] | ||
* @example moveLeft([1,2,3,4,5], 2); // [4,5,1,2,3] | ||
* @example moveLeft(["a","b","c","d","e"], 7) // ["d","e","a","b","c"] | ||
* @example moveLeft(["a","b"], 3) // ["b","a"] | ||
* | ||
* @param {any[]} array - The array to move | ||
* @param {number} times - The number of times to move the array | ||
* @returns {any[]} | ||
* | ||
* @function moveLeft | ||
* @memberof Array | ||
*/ | ||
export function moveLeft(array?: any[], times?: number): any[]; | ||
/** | ||
* @description | ||
* Move an array element to the left | ||
* | ||
* @example moveRight([1,2,3,4,5]); // [2,3,4,5,1] | ||
* @example moveRight([1,2,3,4,5], 2); // [3,4,5,1,2] | ||
* @example moveRight(["a","b","c","d","e"], 7) // ["c","d","e","a","b"] | ||
* @example moveRight(["a","b"], 3) // ["b","a"] | ||
* | ||
* @param {any[]} array - The array to move | ||
* @param {number} times - The number of times to move the array | ||
* @returns {any[]} | ||
* | ||
* @function moveRight | ||
* @memberof Array | ||
*/ | ||
export function moveRight(array?: any[], times?: number): any[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { allEqual } from "./allEqual.js"; | ||
import { choice } from "./choice.js"; | ||
import { findBigObject } from "./findBigObject.js"; | ||
import { findLowObject } from "./findLowObject.js"; | ||
import { isSorted } from "./isSorted.js"; | ||
import { moveLeft } from "./Move.js"; | ||
import { moveRight } from "./Move.js"; | ||
import { shuffle } from "./shuffle.js"; | ||
import { sortAscending } from "./sortAscending.js"; | ||
import { sortAscendingObject } from "./sortAscendingObject.js"; | ||
import { sortDescending } from "./sortDescending.js"; | ||
import { sortDescendingObject } from "./sortDescendingObject.js"; | ||
export { allEqual, choice, findBigObject, findLowObject, isSorted, moveLeft, moveRight, shuffle, sortAscending, sortAscendingObject, sortDescending, sortDescendingObject }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Check if the given array is sorted fom lowest to highest | ||
* | ||
* @example | ||
* isSorted([]) // true | ||
* isSorted([0,0,0,0]) // true | ||
* isSorted([2,1,4]) // false | ||
* isSorted([3,2,1]) // false | ||
* isSorted([1,2,3]) // true | ||
* isSorted(["B","A","D"]) // false | ||
* isSorted(["A","B","C"]) // true | ||
* | ||
* @param {any} arr - the array to check | ||
* @returns {boolean} true if the array is sorted | ||
* | ||
* @function isSorted | ||
* @memberof Array | ||
*/ | ||
export function isSorted(arr?: any): boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* This function will randomize the position of the array items. (change the original array!) | ||
* | ||
* To not mutate the original array pass in the `mutateOriginal` argument false, and this function will return a new array with the original items in random positions. (not changing the original array) | ||
* | ||
* @example shuffle(["A", "B", "C"]); // ["B","A","C"] | ||
* @example shuffle([1,2,3,4,5,6,7,8,9]); // [8,5,1,4,3,6,9,2,7] | ||
* @example shuffle([{a:1},{b:2},{c:3}]); // [{a:1},{c:3},{b:2}] | ||
* | ||
* @param {any[]} array - the array with the items to randomize | ||
* @param {boolean} mutateOriginal - the array with the items to randomize | ||
* @returns {any[]} | ||
* | ||
* @function shuffle | ||
* @memberof Array | ||
*/ | ||
export function shuffle(array: any[], mutateOriginal?: boolean): any[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Detects and returns the browser name | ||
* | ||
* Function based in ➜ {@link https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser} | ||
* | ||
* @example getBrowser(); // Opera | ||
* @example getBrowser(); // Chrome | ||
* @example getBrowser(); // Safari | ||
* @example getBrowser(); // Firefox | ||
* @example getBrowser(); // IE | ||
* @example getBrowser(); // Unknown // Not detect | ||
* | ||
* @returns {String} browser name | ||
* | ||
* @function getBrowser | ||
* @memberof Device | ||
*/ | ||
export function getBrowser(): string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Detects and returns the browser version | ||
* | ||
* Function based in ➜ {@link https://stackoverflow.com/questions/5916900/how-can-you-detect-the-version-of-a-browser} | ||
* | ||
* @example getBrowserVersion(); // 106 | ||
* @example getBrowserVersion(); // 105 | ||
* | ||
* @returns {Number|String} browser version | ||
* | ||
* @function getBrowserVersion | ||
* @memberof Device | ||
*/ | ||
export function getBrowserVersion(): number | string; |
Oops, something went wrong.