Skip to content

Instantly share code, notes, and snippets.

@clementsjj
Created January 10, 2020 16:24
Show Gist options
  • Save clementsjj/697ceec6048682eaccfeeb23b1d3c63c to your computer and use it in GitHub Desktop.
Save clementsjj/697ceec6048682eaccfeeb23b1d3c63c to your computer and use it in GitHub Desktop.
const cleanBoolean = (
x: any,
trueValue: string,
falseValue: string,
onNull = null
): boolean | null => {
if (x === trueValue) {
return true;
}
if (x === falseValue) {
return false;
}
return onNull;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment