Skip to content

Commit

Permalink
Merge pull request #4 from Y0ursTruly/serial-based-crash-testing
Browse files Browse the repository at this point in the history
Serial based crash testing
  • Loading branch information
Y0ursTruly authored Jul 27, 2024
2 parents e7d9bbb + ba979ab commit d40602d
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Share (and sync) Objects Online with the power of websockets. Keys, Values AND R
<br>
**Please note**:
- To view example usage of the modules this library provides, please refer to the _[tests](https://github.com/Y0ursTruly/webject/blob/main/tests.js)_
- TypeScript Definitions Added >:D
- Supporting the `Date` type soon. In the meantime it is advised to `Date` instances into their string or number equivalent

# Installation
Multiple ways
Expand Down
19 changes: 11 additions & 8 deletions for_browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

//see if an enumerable property(of key) exists(in obj)
function includes(obj,key){
if(!obj) return false;
if( (obj instanceof Array) && (key==="length") ) return true;
let existing=describe(obj,key)
return existing?existing.enumerable:false
Expand Down Expand Up @@ -80,12 +81,12 @@
}
if(typeof item!=="object") return item; //numbers, strings
//also functions but these get ignored either way
let shell=item instanceof Array? ([]): ({}), keys=Object.keys(item);
for(let i=0;i<keys.length;i++){
let ITEM=item[keys[i]]
let shell=item instanceof Array? ([]): ({}), KEYS=keys(item);
for(let i=0;i<KEYS.length;i++){
let ITEM=item[KEYS[i]]
if(typeof ITEM==="bigint" || ITEM===undefined) continue;
if(!ITEM || (!ITEM[Symbol.toStringTag] && typeof ITEM!=="object"))
shell[keys[i]] = ITEM;
shell[KEYS[i]] = ITEM;
}
return shell
}
Expand All @@ -106,10 +107,10 @@
if(!orig) return null;
let metadata=map.get(orig)
if(!metadata) return map.delete(cloned);
let keys=Object.keys(cloned);
for(let i=0;i<keys.length;i++)
if(typeof cloned[keys[i]]==="object" && cloned[keys[i]])
recursivelyDetatch(map,cloned[keys[i]]);
let KEYS=keys(cloned);
for(let i=0;i<KEYS.length;i++)
if(typeof cloned[KEYS[i]]==="object" && cloned[KEYS[i]])
recursivelyDetatch(map,cloned[KEYS[i]]);
if(--metadata[4]) return null;
map.delete(orig)
map.delete(cloned)
Expand Down Expand Up @@ -169,6 +170,8 @@
}
if(typeof item==="symbol" || (typeof item==="object" && item!==null)){
if(!temp){
const former=map.get(clone[key])
if(former) map.delete(former);
map.set(item,[Path,list.length-1,newEntry?1:0,clone[key],1]);
map.set(clone[key],item);
}
Expand Down
2 changes: 1 addition & 1 deletion for_browser.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webject",
"version": "1.4.7",
"version": "1.4.8",
"description": "Share Objects Online with the power of websockets. Keys, Values AND references. Webject is short for Web Object and it really is a system for sharing objects on the web. Someone can host an object, and make authTokens for others online to share this object",
"main": "webject.js",
"scripts": {
Expand Down
Loading

0 comments on commit d40602d

Please sign in to comment.