Skip to content

Instantly share code, notes, and snippets.

@NishuGoel
Last active December 21, 2019 18:03
Show Gist options
  • Save NishuGoel/e4bcf50ea08af22ac526d79192915cf1 to your computer and use it in GitHub Desktop.
Save NishuGoel/e4bcf50ea08af22ac526d79192915cf1 to your computer and use it in GitHub Desktop.
export function equalArraysOrString(a: string | string[], b: string | string[]) {
if (Array.isArray(a) && Array.isArray(b)) {
if (a.length != b.length) return false;
return a.every(aItem => b.indexOf(aItem) > -1);
} else {
return a === b;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment