This repository was archived by the owner on Dec 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,5 +14,6 @@ module.exports = {
1414 "util" : {
1515 "removeDuplicates" : require ( "./modules/util/removeDuplicates" )
1616 } ,
17+ "removeDuplicates" : require ( "./modules/removeDuplicates" ) ,
1718 "uuid" : require ( "./modules/uuid" )
1819}
Original file line number Diff line number Diff line change 1+ /**
2+ *
3+ * @function `flip` - Quickly execute a heads or tails decision randomly
4+ * @returns {string } Returns "heads" or "tails" (*as string*)
5+ */
6+
17function flip ( ) {
28 return Math . random ( ) >= 0.5 ? "heads" : "tails" ;
39}
410
5- module . exports = flip ;
11+ module . exports = flip ;
Original file line number Diff line number Diff line change 11const { customAlphabet } = require ( "nanoid" ) ;
22
3+ /**
4+ * @function `id` - Randomly generate a unique ID composed of random characters and numbers
5+ * @param {Number } length - (*Required*) The length of the ID. Condition: *`1 <= length <= 64`*
6+ * @returns {String } A unique ID string of a specified length (e.g. *abthvmyt3h1j3it*)
7+ */
8+
39function id ( length ) {
410 if ( ! length ) throw new Error ( "No length specified" ) ;
511 if ( typeof length !== "number" ) throw new Error ( "Invalid type specified" ) ;
@@ -12,4 +18,4 @@ function id(length) {
1218 return id ;
1319}
1420
15- module . exports = id ;
21+ module . exports = id ;
Original file line number Diff line number Diff line change 1+ /**
2+ * @function `log` - Quickly log any data to the console.
3+ * @param {any } input - *Required* The data that will be passed on to the console. Will throw an error if the input is undefined
4+ * @returns {Function } an Instance of console.log() that is executed instantly using `input`
5+ */
6+
17function log ( input ) {
2- if ( ! input ) {
3- throw new Error ( "No input specified" ) ;
4- }
8+ if ( ! input ) throw new Error ( "No input specified" ) ;
59
610 return console . log ( input ) ;
711}
812
9- module . exports = log ;
13+ module . exports = log ;
Original file line number Diff line number Diff line change 1+ /**
2+ * @function `print` - Quickly log any data to the console.
3+ * @param {any } input - *Required* The data that will be passed on to the console. Will throw an error if the input is undefined
4+ * @returns {Function } An instance of console.log() that is executed instantly using `input`
5+ */
6+
17function print ( input ) {
2- if ( ! input ) {
3- throw new Error ( "No input specified" ) ;
4- }
8+ if ( ! input ) throw new Error ( "No input specified" ) ;
59
610 return console . log ( input ) ;
711}
812
9- module . exports = print ;
13+ module . exports = print ;
Original file line number Diff line number Diff line change 1+ /**
2+ * @function `random` - Used to generate a random number between 1 and a max value
3+ * @param {Number } [max] - The max value used. Condition: **`1 < max < 2_147_483_647`**
4+ * @returns {Number } A random number between 1 and max (*parameter*). If max is *undefined*, will return a random number between 1 and 100
5+ */
6+
17function random ( max ) {
28 let highest = 100 ;
39
@@ -11,4 +17,4 @@ function random(max) {
1117 return result ;
1218}
1319
14- module . exports = random ;
20+ module . exports = random ;
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ const removeDuplicates = (
6565 } ) ;
6666 } else if ( typeof truthy_only !== "boolean" )
6767 throw new MethodException (
68- `Illegal use of parameter multi_dim - Expected true or false - Found: ${ truthy_only } `
68+ `Illegal use of parameter truthy_only - Expected true or false - Found: ${ truthy_only } `
6969 ) ;
7070
7171 // Sort
@@ -122,7 +122,7 @@ const removeDuplicates = (
122122 } else if ( e === "lengthwise" ) {
123123 newArray . sort ( ( a , b ) =>
124124 ( typeof a === "string" && typeof b == "string" ) ||
125- ( Array . isArray ( a ) && Array . isArray ( b ) )
125+ ( Array . isArray ( a ) && Array . isArray ( b ) )
126126 ? a . length - b . length
127127 : - 1
128128 ) ;
Original file line number Diff line number Diff line change 1+ /**
2+ * @function `uuid` - Randomly generate a unique UUID composed of random characters and numbers
3+ * @returns {String } A unique UUID string that follows this rule: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
4+ */
5+
16function uuid ( ) {
27 var d = new Date ( ) . getTime ( ) ;
38
You can’t perform that action at this time.
0 commit comments