mirror of
https://github.com/amark/gun.git
synced 2025-11-23 22:15:55 +00:00
later with @bmatusiak check sea.then for '../gun.js' vs '../' vs ... note: src/index -> core.js TODO: something about WebRTC candidates hitting ack decrement limits?
18 lines
712 B
JavaScript
18 lines
712 B
JavaScript
;(function(){
|
|
|
|
// Valid values are a subset of JSON: null, binary, number (!Infinity), text,
|
|
// or a soul relation. Arrays need special algorithms to handle concurrency,
|
|
// so they are not supported directly. Use an extension that supports them if
|
|
// needed but research their problems first.
|
|
module.exports = function(v){
|
|
// "deletes", nulling out keys.
|
|
return v === null ||
|
|
"string" === typeof v ||
|
|
"boolean" === typeof v ||
|
|
// we want +/- Infinity to be, but JSON does not support it, sad face.
|
|
// can you guess what v === v checks for? ;)
|
|
("number" === typeof v && v != Infinity && v != -Infinity && v === v) ||
|
|
(!!v && "string" == typeof v["#"] && Object.keys(v).length === 1 && v["#"]);
|
|
}
|
|
|
|
}()); |