Skip to content

Instantly share code, notes, and snippets.

@ahallora
Created February 20, 2017 19:31
Show Gist options
  • Save ahallora/41197a2f1ced16340e4c0e0f306272d9 to your computer and use it in GitHub Desktop.
Save ahallora/41197a2f1ced16340e4c0e0f306272d9 to your computer and use it in GitHub Desktop.
Various functions to check the integrity of data.
function isString(x) {
return x !== null && x !== undefined && x.constructor === String
}
function isNumber(x) {
return x !== null && x !== undefined && x.constructor === Number
}
function isBoolean(x) {
return x !== null && x !== undefined && x.constructor === Boolean
}
function isObject(x) {
return x !== null && x !== undefined && x.constructor === Object
}
function isArray(x) {
return x !== null && x !== undefined && x.constructor === Array
}
/* source: https://github.com/realm-demos/realm-scanner/blob/master/Server/index.js */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment