shuffleString
Description
Resolves a shuffled version of a string.
Parameter List | Returns | Rejection Errors |
---|---|---|
| Promise<string || Array> | |
Related Functions | Function Signature | |
function shuffleString(str[, tuple]): Promise<string || Array> |
Examples
1
2
3
4
import { shuffleString } from "puddy-m/lib/helpers";
// Shuffling the "amanda" string.
shuffleString("amanda").then((shuffledContent) => console.log(shuffledContent)); // possible outome: "mnaada"
1
2
3
4
5
6
7
8
9
import { shuffleString } from "puddy-m/lib/helpers";
// Shufling the "amanda" and "jefferson" strings
shuffleString("amanda", [])
.then((tuple) => shuffleString("jefferson", tuple))
.then(([shuffledString1, shuffleString2]) => {
console.log(shuffledString1); // Possible outome: admnaa
console.log(shuffleString2); // Possible outome: erjseofnf
});
1
2
3
4
5
6
7
8
9
import { shuffleString } from "puddy-m/lib/helpers";
// It also works with await.
const f = async () => {
const shuffledString = await shuffleString("jefferson");
console.log(shuffledString);
};
f();