diff --git a/.gitignore b/.gitignore index 2baf421..40c1993 100644 --- a/.gitignore +++ b/.gitignore @@ -40,12 +40,12 @@ bower_components .lock-wscript # Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release +# build/Release # Dependency directories node_modules/ jspm_packages/ -build/ +# build/ dist/ # Snowpack dependency directory (https://snowpack.dev/) diff --git a/.npmignore b/.npmignore index 839daeb..63eee07 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,3 @@ -.git +.github node_modules src \ No newline at end of file diff --git a/build/index.d.ts b/build/index.d.ts new file mode 100644 index 0000000..890a5c1 --- /dev/null +++ b/build/index.d.ts @@ -0,0 +1,12 @@ +import * as shuffle from './utils'; +export default shuffle; +export declare const alphabets: typeof shuffle.alphabets, capitalize: typeof shuffle.capitalize, generateRandomString: typeof shuffle.generateRandomString, lowerCaseLetters: string[], shuffleString: typeof shuffle.shuffleString, symbols: string[], upperCaseLetters: string[]; +export declare type AlphabetType = typeof alphabets; +export declare type CapitalizeType = typeof capitalize; +export declare type LowerCaseLetterType = typeof lowerCaseLetters; +export declare type UpperCaseLetterType = typeof upperCaseLetters; +export declare type NumberType = typeof symbols; +export declare type SymbolType = typeof symbols; +export declare type GenerateRandomstringType = typeof generateRandomString; +export declare type ShuffleStringType = typeof shuffleString; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/build/index.d.ts.map b/build/index.d.ts.map new file mode 100644 index 0000000..6e38079 --- /dev/null +++ b/build/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,eAAe,OAAO,CAAC;AAEvB,eAAO,MACN,SAAS,4BACT,UAAU,6BACV,oBAAoB,uCACpB,gBAAgB,YAChB,aAAa,gCACb,OAAO,YACP,gBAAgB,UACN,CAAC;AAEZ,oBAAY,YAAY,GAAG,OAAO,SAAS,CAAC;AAC5C,oBAAY,cAAc,GAAG,OAAO,UAAU,CAAC;AAC/C,oBAAY,mBAAmB,GAAG,OAAO,gBAAgB,CAAC;AAC1D,oBAAY,mBAAmB,GAAG,OAAO,gBAAgB,CAAC;AAC1D,oBAAY,UAAU,GAAG,OAAO,OAAO,CAAC;AACxC,oBAAY,UAAU,GAAG,OAAO,OAAO,CAAC;AACxC,oBAAY,wBAAwB,GAAG,OAAO,oBAAoB,CAAC;AACnE,oBAAY,iBAAiB,GAAG,OAAO,aAAa,CAAC"} \ No newline at end of file diff --git a/build/index.js b/build/index.js new file mode 100644 index 0000000..4e1dba2 --- /dev/null +++ b/build/index.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.upperCaseLetters = exports.symbols = exports.shuffleString = exports.lowerCaseLetters = exports.generateRandomString = exports.capitalize = exports.alphabets = void 0; +const tslib_1 = require("tslib"); +const shuffle = tslib_1.__importStar(require("./utils")); +exports.default = shuffle; +exports.alphabets = shuffle.alphabets, exports.capitalize = shuffle.capitalize, exports.generateRandomString = shuffle.generateRandomString, exports.lowerCaseLetters = shuffle.lowerCaseLetters, exports.shuffleString = shuffle.shuffleString, exports.symbols = shuffle.symbols, exports.upperCaseLetters = shuffle.upperCaseLetters; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/index.js.map b/build/index.js.map new file mode 100644 index 0000000..94c9070 --- /dev/null +++ b/build/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,yDAAmC;AAEnC,kBAAe,OAAO,CAAC;AAGtB,iBAAS,GAON,OAAO,YANV,kBAAU,GAMP,OAAO,aALV,4BAAoB,GAKjB,OAAO,uBAJV,wBAAgB,GAIb,OAAO,mBAHV,qBAAa,GAGV,OAAO,gBAFV,eAAO,GAEJ,OAAO,UADV,wBAAgB,GACb,OAAO,kBAAC"} \ No newline at end of file diff --git a/build/utils/alphabet.d.ts b/build/utils/alphabet.d.ts new file mode 100644 index 0000000..cb968e9 --- /dev/null +++ b/build/utils/alphabet.d.ts @@ -0,0 +1,22 @@ +/** + * + * A function that generates alphabet characters and symbols + * + */ +declare function alphabets(): { + alphabet: string[]; + lowerCaseLetters: string[]; + upperCaseLetters: string[]; + numbers: string[]; + symbols: string[]; +}; +export declare const lowerCaseLetters: string[], alphabet: string[], upperCaseLetters: string[], numbers: string[], symbols: string[]; +export { alphabets }; +export default alphabets; +export declare type LowerCaseLetterType = typeof lowerCaseLetters; +export declare type UpperCaseLetterType = typeof upperCaseLetters; +export declare type NumberType = typeof numbers; +export declare type SymbolType = typeof symbols; +export declare type AlphabetType = typeof alphabet; +export declare type AlphabetTypeWithLowerCase = LowerCaseLetterType & UpperCaseLetterType & NumberType & SymbolType; +//# sourceMappingURL=alphabet.d.ts.map \ No newline at end of file diff --git a/build/utils/alphabet.d.ts.map b/build/utils/alphabet.d.ts.map new file mode 100644 index 0000000..8c48306 --- /dev/null +++ b/build/utils/alphabet.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"alphabet.d.ts","sourceRoot":"","sources":["../../src/utils/alphabet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,iBAAS,SAAS;;;;;;EAyCjB;AAED,eAAO,MACN,gBAAgB,YAChB,QAAQ,YACR,gBAAgB,YAChB,OAAO,YACP,OAAO,UACO,CAAC;AAEhB,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,eAAe,SAAS,CAAC;AAEzB,oBAAY,mBAAmB,GAAG,OAAO,gBAAgB,CAAC;AAC1D,oBAAY,mBAAmB,GAAG,OAAO,gBAAgB,CAAC;AAC1D,oBAAY,UAAU,GAAG,OAAO,OAAO,CAAC;AACxC,oBAAY,UAAU,GAAG,OAAO,OAAO,CAAC;AACxC,oBAAY,YAAY,GAAG,OAAO,QAAQ,CAAC;AAC3C,oBAAY,yBAAyB,GAAG,mBAAmB,GAC1D,mBAAmB,GACnB,UAAU,GACV,UAAU,CAAC"} \ No newline at end of file diff --git a/build/utils/alphabet.js b/build/utils/alphabet.js new file mode 100644 index 0000000..32b5b51 --- /dev/null +++ b/build/utils/alphabet.js @@ -0,0 +1,50 @@ +"use strict"; +var _a; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.alphabets = exports.symbols = exports.numbers = exports.upperCaseLetters = exports.alphabet = exports.lowerCaseLetters = void 0; +/** + * + * A function that generates alphabet characters and symbols + * + */ +function alphabets() { + const lowerCaseLetters = []; + const upperCaseLetters = []; + const symbols = []; + const numbers = []; + const llRange = [97, 122]; + const symbolRange = [33, 47]; + const numberRange = [48, 57]; + const uppRange = [65, 90]; + /** + * Generate lowercase letters + */ + for (let index = llRange[0]; index <= llRange[1]; index++) + lowerCaseLetters.push(String.fromCharCode(index)); + /** + * Generate uppercase letters + */ + for (let index = uppRange[0]; index <= uppRange[1]; index++) + upperCaseLetters.push(String.fromCharCode(index)); + /** + * Generate numbers + */ + for (let index = numberRange[0]; index <= numberRange[1]; index++) + numbers.push(String.fromCharCode(index)); + /** + * Generate Symbols + */ + for (let index = symbolRange[0]; index <= symbolRange[1]; index++) { + // ![34, 39, 44, 46, 58, 59].includes(index) && + symbols.push(String.fromCharCode(index)); + } + const alphabet = upperCaseLetters + .concat(lowerCaseLetters) + .concat(numbers) + .concat(symbols); + return { alphabet, lowerCaseLetters, upperCaseLetters, numbers, symbols }; +} +exports.alphabets = alphabets; +_a = alphabets(), exports.lowerCaseLetters = _a.lowerCaseLetters, exports.alphabet = _a.alphabet, exports.upperCaseLetters = _a.upperCaseLetters, exports.numbers = _a.numbers, exports.symbols = _a.symbols; +exports.default = alphabets; +//# sourceMappingURL=alphabet.js.map \ No newline at end of file diff --git a/build/utils/alphabet.js.map b/build/utils/alphabet.js.map new file mode 100644 index 0000000..3b3a6a4 --- /dev/null +++ b/build/utils/alphabet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"alphabet.js","sourceRoot":"","sources":["../../src/utils/alphabet.ts"],"names":[],"mappings":";;;;AAAA;;;;GAIG;AACH,SAAS,SAAS;IACjB,MAAM,gBAAgB,GAAG,EAAE,CAAC;IAC5B,MAAM,gBAAgB,GAAG,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,MAAM,OAAO,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC1B,MAAM,WAAW,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7B,MAAM,WAAW,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7B,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1B;;OAEG;IACH,KAAK,IAAI,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE;QACxD,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAEnD;;OAEG;IACH,KAAK,IAAI,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE;QAC1D,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAEnD;;OAEG;IACH,KAAK,IAAI,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE;QAChE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAE1C;;OAEG;IACH,KAAK,IAAI,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QAClE,+CAA+C;QAC/C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;KACzC;IAED,MAAM,QAAQ,GAAG,gBAAgB;SAC/B,MAAM,CAAC,gBAAgB,CAAC;SACxB,MAAM,CAAC,OAAO,CAAC;SACf,MAAM,CAAC,OAAO,CAAC,CAAC;IAElB,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC3E,CAAC;AAUQ,8BAAS;AARL,KAMT,SAAS,EAAE,EALd,wBAAgB,wBAChB,gBAAQ,gBACR,wBAAgB,wBAChB,eAAO,eACP,eAAO,cACQ;AAIhB,kBAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/build/utils/capitalize.d.ts b/build/utils/capitalize.d.ts new file mode 100644 index 0000000..8e96bb3 --- /dev/null +++ b/build/utils/capitalize.d.ts @@ -0,0 +1,12 @@ +/** + * + * A function that capitalizes the first letter of a string + * @param {string} text + * @returns {string} text + * + */ +declare function capitalize(text: string): string; +export { capitalize }; +export default capitalize; +export declare type CapitalizeType = typeof capitalize; +//# sourceMappingURL=capitalize.d.ts.map \ No newline at end of file diff --git a/build/utils/capitalize.d.ts.map b/build/utils/capitalize.d.ts.map new file mode 100644 index 0000000..329299f --- /dev/null +++ b/build/utils/capitalize.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"capitalize.d.ts","sourceRoot":"","sources":["../../src/utils/capitalize.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIxC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,eAAe,UAAU,CAAC;AAE1B,oBAAY,cAAc,GAAG,OAAO,UAAU,CAAC"} \ No newline at end of file diff --git a/build/utils/capitalize.js b/build/utils/capitalize.js new file mode 100644 index 0000000..9b9185d --- /dev/null +++ b/build/utils/capitalize.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.capitalize = void 0; +/** + * + * A function that capitalizes the first letter of a string + * @param {string} text + * @returns {string} text + * + */ +function capitalize(text) { + return text.charCodeAt(0) > 64 && text.charCodeAt(0) < 97 + ? text + : text.charAt(0).toLocaleUpperCase() + text.slice(1); +} +exports.capitalize = capitalize; +exports.default = capitalize; +//# sourceMappingURL=capitalize.js.map \ No newline at end of file diff --git a/build/utils/capitalize.js.map b/build/utils/capitalize.js.map new file mode 100644 index 0000000..0522a2f --- /dev/null +++ b/build/utils/capitalize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"capitalize.js","sourceRoot":"","sources":["../../src/utils/capitalize.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,IAAY;IAC/B,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE;QACxD,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC;AAEQ,gCAAU;AAEnB,kBAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/build/utils/index.d.ts b/build/utils/index.d.ts new file mode 100644 index 0000000..73b5881 --- /dev/null +++ b/build/utils/index.d.ts @@ -0,0 +1,15 @@ +import { alphabets } from './alphabet'; +import { capitalize } from './capitalize'; +import { generateRandomString } from './string-random'; +import { lowerCaseLetters } from './alphabet'; +import { shuffleString } from './shuffle-string'; +import { symbols } from './alphabet'; +import { upperCaseLetters } from './alphabet'; +export { alphabets, capitalize, generateRandomString, lowerCaseLetters, upperCaseLetters, shuffleString, symbols, }; +export declare type AlphabetType = typeof alphabets; +export declare type CapitalizeType = typeof capitalize; +export declare type LowerCaseLetterType = typeof lowerCaseLetters; +export declare type UpperCaseLetterType = typeof upperCaseLetters; +export declare type NumberType = typeof symbols; +export declare type SymbolType = typeof symbols; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/build/utils/index.d.ts.map b/build/utils/index.d.ts.map new file mode 100644 index 0000000..fcf37c9 --- /dev/null +++ b/build/utils/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EACN,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,OAAO,GACP,CAAC;AAEF,oBAAY,YAAY,GAAG,OAAO,SAAS,CAAC;AAC5C,oBAAY,cAAc,GAAG,OAAO,UAAU,CAAC;AAC/C,oBAAY,mBAAmB,GAAG,OAAO,gBAAgB,CAAC;AAC1D,oBAAY,mBAAmB,GAAG,OAAO,gBAAgB,CAAC;AAC1D,oBAAY,UAAU,GAAG,OAAO,OAAO,CAAC;AACxC,oBAAY,UAAU,GAAG,OAAO,OAAO,CAAC"} \ No newline at end of file diff --git a/build/utils/index.js b/build/utils/index.js new file mode 100644 index 0000000..9278a12 --- /dev/null +++ b/build/utils/index.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.symbols = exports.shuffleString = exports.upperCaseLetters = exports.lowerCaseLetters = exports.generateRandomString = exports.capitalize = exports.alphabets = void 0; +const alphabet_1 = require("./alphabet"); +Object.defineProperty(exports, "alphabets", { enumerable: true, get: function () { return alphabet_1.alphabets; } }); +const capitalize_1 = require("./capitalize"); +Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return capitalize_1.capitalize; } }); +const string_random_1 = require("./string-random"); +Object.defineProperty(exports, "generateRandomString", { enumerable: true, get: function () { return string_random_1.generateRandomString; } }); +const alphabet_2 = require("./alphabet"); +Object.defineProperty(exports, "lowerCaseLetters", { enumerable: true, get: function () { return alphabet_2.lowerCaseLetters; } }); +const shuffle_string_1 = require("./shuffle-string"); +Object.defineProperty(exports, "shuffleString", { enumerable: true, get: function () { return shuffle_string_1.shuffleString; } }); +const alphabet_3 = require("./alphabet"); +Object.defineProperty(exports, "symbols", { enumerable: true, get: function () { return alphabet_3.symbols; } }); +const alphabet_4 = require("./alphabet"); +Object.defineProperty(exports, "upperCaseLetters", { enumerable: true, get: function () { return alphabet_4.upperCaseLetters; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/utils/index.js.map b/build/utils/index.js.map new file mode 100644 index 0000000..1c9cacd --- /dev/null +++ b/build/utils/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,yCAAuC;AAStC,0FATQ,oBAAS,OASR;AARV,6CAA0C;AASzC,2FATQ,uBAAU,OASR;AARX,mDAAuD;AAStD,qGATQ,oCAAoB,OASR;AARrB,yCAA8C;AAS7C,iGATQ,2BAAgB,OASR;AARjB,qDAAiD;AAUhD,8FAVQ,8BAAa,OAUR;AATd,yCAAqC;AAUpC,wFAVQ,kBAAO,OAUR;AATR,yCAA8C;AAO7C,iGAPQ,2BAAgB,OAOR"} \ No newline at end of file diff --git a/build/utils/shuffle-string.d.ts b/build/utils/shuffle-string.d.ts new file mode 100644 index 0000000..03f1367 --- /dev/null +++ b/build/utils/shuffle-string.d.ts @@ -0,0 +1,9 @@ +/** + *A function to shuffle a string passed as an argument + * @param {string} word + * @returns + */ +declare function shuffleString(word: string): string; +export { shuffleString }; +export declare type ShuffleStringType = typeof shuffleString; +//# sourceMappingURL=shuffle-string.d.ts.map \ No newline at end of file diff --git a/build/utils/shuffle-string.d.ts.map b/build/utils/shuffle-string.d.ts.map new file mode 100644 index 0000000..060b5d4 --- /dev/null +++ b/build/utils/shuffle-string.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"shuffle-string.d.ts","sourceRoot":"","sources":["../../src/utils/shuffle-string.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,iBAAS,aAAa,CAAC,IAAI,EAAE,MAAM,UAYlC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,oBAAY,iBAAiB,GAAG,OAAO,aAAa,CAAC"} \ No newline at end of file diff --git a/build/utils/shuffle-string.js b/build/utils/shuffle-string.js new file mode 100644 index 0000000..5e82b08 --- /dev/null +++ b/build/utils/shuffle-string.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.shuffleString = void 0; +/** + *A function to shuffle a string passed as an argument + * @param {string} word + * @returns + */ +function shuffleString(word) { + const stringArray = word.split(''); + const wordLength = stringArray.length; + for (let index = wordLength - 1; index > 0; index--) { + const temp = Math.floor(Math.random() * (index + 1)); + const tmp = stringArray[index]; + stringArray[index] = stringArray[temp]; + stringArray[temp] = tmp; + } + return stringArray.join(''); +} +exports.shuffleString = shuffleString; +//# sourceMappingURL=shuffle-string.js.map \ No newline at end of file diff --git a/build/utils/shuffle-string.js.map b/build/utils/shuffle-string.js.map new file mode 100644 index 0000000..5bf3faa --- /dev/null +++ b/build/utils/shuffle-string.js.map @@ -0,0 +1 @@ +{"version":3,"file":"shuffle-string.js","sourceRoot":"","sources":["../../src/utils/shuffle-string.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,SAAS,aAAa,CAAC,IAAY;IAClC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACnC,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC;IAEtC,KAAK,IAAI,KAAK,GAAG,UAAU,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;QACrD,MAAM,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;QAC/B,WAAW,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QACvC,WAAW,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;KACxB;IAED,OAAO,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC7B,CAAC;AAEQ,sCAAa"} \ No newline at end of file diff --git a/build/utils/string-random.d.ts b/build/utils/string-random.d.ts new file mode 100644 index 0000000..16632a0 --- /dev/null +++ b/build/utils/string-random.d.ts @@ -0,0 +1,10 @@ +/** + *A function that generates alphabet characters and symbols on a given length + * @param {number} numberOfCharacters + * @returns + */ +declare function generateRandomString(numberOfCharacters: number): string; +export { generateRandomString }; +export declare type GenerateRandomStringType = typeof generateRandomString; +export default generateRandomString; +//# sourceMappingURL=string-random.d.ts.map \ No newline at end of file diff --git a/build/utils/string-random.d.ts.map b/build/utils/string-random.d.ts.map new file mode 100644 index 0000000..8763b89 --- /dev/null +++ b/build/utils/string-random.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"string-random.d.ts","sourceRoot":"","sources":["../../src/utils/string-random.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,iBAAS,oBAAoB,CAAC,kBAAkB,EAAE,MAAM,UAcvD;AAGD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAChC,oBAAY,wBAAwB,GAAG,OAAO,oBAAoB,CAAC;AACnE,eAAe,oBAAoB,CAAC"} \ No newline at end of file diff --git a/build/utils/string-random.js b/build/utils/string-random.js new file mode 100644 index 0000000..2646034 --- /dev/null +++ b/build/utils/string-random.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.generateRandomString = void 0; +const alphabet_1 = require("./alphabet"); +/** + *A function that generates alphabet characters and symbols on a given length + * @param {number} numberOfCharacters + * @returns + */ +function generateRandomString(numberOfCharacters) { + const string = alphabet_1.lowerCaseLetters + .concat(alphabet_1.upperCaseLetters) + .concat(alphabet_1.symbols) + .concat(alphabet_1.numbers); + let randomString = ''; + console.log('Alphabet', string); + for (let i = 0; i < numberOfCharacters; i++) { + const randomIndex = Math.floor(Math.random() * string.length); + randomString += string[randomIndex]; + } + return randomString; +} +exports.generateRandomString = generateRandomString; +exports.default = generateRandomString; +//# sourceMappingURL=string-random.js.map \ No newline at end of file diff --git a/build/utils/string-random.js.map b/build/utils/string-random.js.map new file mode 100644 index 0000000..bff7c34 --- /dev/null +++ b/build/utils/string-random.js.map @@ -0,0 +1 @@ +{"version":3,"file":"string-random.js","sourceRoot":"","sources":["../../src/utils/string-random.ts"],"names":[],"mappings":";;;AAAA,yCAKoB;AAEpB;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,kBAA0B;IACvD,MAAM,MAAM,GAAG,2BAAgB;SAC7B,MAAM,CAAC,2BAAgB,CAAC;SACxB,MAAM,CAAC,kBAAO,CAAC;SACf,MAAM,CAAC,kBAAO,CAAC,CAAC;IAClB,IAAI,YAAY,GAAG,EAAE,CAAC;IACtB,OAAO,CAAC,GAAG,CAAC,UAAU,EAAC,MAAM,CAAC,CAAC;IAE/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,kBAAkB,EAAE,CAAC,EAAE,EAAE;QAC5C,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QAC9D,YAAY,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC;KACpC;IAED,OAAO,YAAY,CAAC;AACrB,CAAC;AAGQ,oDAAoB;AAE7B,kBAAe,oBAAoB,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index d5de136..7ea660e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "string-shuffle", - "version": "1.2.1", + "version": "1.2.2", "description": "A JS module for shuffling strings and other helper methods like alhpabet generation", "main": "./build/index.js", "scripts": {