Created
February 20, 2017 19:31
-
-
Save ahallora/41197a2f1ced16340e4c0e0f306272d9 to your computer and use it in GitHub Desktop.
Various functions to check the integrity of data.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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