Skip to content

Instantly share code, notes, and snippets.

@roman01la
Last active June 2, 2020 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roman01la/c02b0204bda807d20b3413b6f7b799e9 to your computer and use it in GitHub Desktop.
Save roman01la/c02b0204bda807d20b3413b6f7b799e9 to your computer and use it in GitHub Desktop.
function googIsObject(v) {
var type = typeof v;
return "object" == type && null != v || "function" == type;
}
function isPrototype(v) {
return v === v.constructor.prototype;
}
function isCLJSType(v) {
return v.cljs$lang$type === true && googIsObject(v) && !isPrototype(v);
}
function isCLJSInstance(v) {
return googIsObject(v) && isCLJSType(v.constructor);
}
function isCLJSValue(v) {
// TODO: cljs-fn?
// TODO: print Symbol
return isCLJSInstance(v) && !isPrototype(v) && (typeof v !== "symbol");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment