Skip to content

Instantly share code, notes, and snippets.

@sergueyarellano
Created May 26, 2021 14:15
Show Gist options
  • Save sergueyarellano/a56dea6232d3b056d8454c441cae65c9 to your computer and use it in GitHub Desktop.
Save sergueyarellano/a56dea6232d3b056d8454c441cae65c9 to your computer and use it in GitHub Desktop.
function checkTypeWith (input, model) {
return key => {
const expectedType = model[key]
return /^array$/.test(expectedType)
? Array.isArray(input[key])
: typeof input[key] === model[key]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment