@bbn/bbn 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ /**
2
+ *
3
+ * @param {Array} array
4
+ * @returns Array
5
+ */
6
+ declare const shuffle: (array: any) => any;
7
+ export { shuffle };
@@ -0,0 +1,20 @@
1
+ /**
2
+ *
3
+ * @param {Array} array
4
+ * @returns Array
5
+ */
6
+ const shuffle = function (array) {
7
+ let currentIndex = array.length, randomIndex;
8
+ // While there remain elements to shuffle.
9
+ while (currentIndex != 0) {
10
+ // Pick a remaining element.
11
+ randomIndex = Math.floor(Math.random() * currentIndex);
12
+ currentIndex--;
13
+ // And swap it with the current element.
14
+ [array[currentIndex], array[randomIndex]] = [
15
+ array[randomIndex], array[currentIndex]
16
+ ];
17
+ }
18
+ return array;
19
+ };
20
+ export { shuffle };
@@ -0,0 +1,6 @@
1
+ declare const bbn: {
2
+ fn: {
3
+ shuffle: (array: any) => any;
4
+ };
5
+ };
6
+ export { bbn };
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import { shuffle } from './fn/shuffle';
2
+ const bbn = {
3
+ fn: {
4
+ shuffle
5
+ }
6
+ };
7
+ export { bbn };
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@bbn/bbn",
3
+ "version": "1.0.0",
4
+ "description": "Javascript toolkit",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "/dist"
9
+ ],
10
+ "scripts": {
11
+ "test": "echo \"Error: no test specified\" && exit 1"
12
+ },
13
+ "keywords": [
14
+ "toolkit"
15
+ ],
16
+ "author": "Thomas Nabet <thomas.nabet@gmail.com>",
17
+ "license": "ISC",
18
+ "devDependencies": {
19
+ "typescript": "^5.2.2"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/nabab/bbn-js.git"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/nabab/bbn-js/issues"
27
+ },
28
+ "homepage": "https://github.com/nabab/bbn-js#readme"
29
+ }