Shaolinmkz Utils
Util functions for multiple uses.
Installation
npm install shaolinmkz-utils
OR
yarn add shaolinmkz-utils
Usage
import { cleanUpDuplicateAsync } from "shaolinmkz-utils";
const dirtyData = [
" Chukwuemeka Obiora Musa ",
"Nwabuzor Obiora Chukwuemeka",
" Chukwuemeka Obiora Nwabuzor ",
" Chukwuemeka Obiora Musa ",
" Nwabuzor Chukwuemeka Obiora ",
"Chukwuemeka null Nwabuzor",
"undefined Chukwuemeka UNDEFINED Nwabuzor",
"Nwabuzor Chukwuemeka Obiora",
"Chukwuemeka undefined Obiora Nwabuzor",
" Chukwuemeka James Nwabuzor ",
];
const result1 = await cleanUpDuplicateAsync(dirtyData);
console.log(result);
// [
// 'Chukwuemeka Obiora Musa',
// 'Nwabuzor Obiora Chukwuemeka',
// 'Chukwuemeka James Nwabuzor'
// ]
try {
await cleanUpDuplicateAsync([undefined]);
} catch (error) {
console.log(error);
// {
// message: "The function argument must be an array of strings"
// }
}