Skip to content

Instantly share code, notes, and snippets.

@dechowdev
Created July 20, 2021 07:53
Show Gist options
  • Save dechowdev/9151452e51bc22b42e0e098be7457e3b to your computer and use it in GitHub Desktop.
Save dechowdev/9151452e51bc22b42e0e098be7457e3b to your computer and use it in GitHub Desktop.
Classname Util
const cn = (arr) =>
arr
.map((v) => {
const vals =
v &&
Object.keys(v).filter((k) => {
return v[k] && typeof v !== "string";
});
return v?.length > 0 ? v : null || (vals && vals.flat()) || v;
})
.filter(Boolean)
.flat();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment