feat(smartjson): Implement stableOneWayStringify: deterministic, cycle-safe JSON for hashing/comparisons; update docs and tests
This commit is contained in:
		@@ -104,4 +104,15 @@ tap.test('should respect simpleOrderArray comparator', async () => {
 | 
			
		||||
  expect(ordered.indexOf('"a"')).toBeLessThan(ordered.indexOf('"c"'));
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.test('stableOneWayStringify should handle circular references without throwing', async () => {
 | 
			
		||||
  const a: any = { name: 'x' };
 | 
			
		||||
  a.self = a;
 | 
			
		||||
  const b: any = { name: 'x' };
 | 
			
		||||
  b.self = b;
 | 
			
		||||
  const s1 = smartjson.stableOneWayStringify(a);
 | 
			
		||||
  const s2 = smartjson.stableOneWayStringify(b);
 | 
			
		||||
  expect(typeof s1).toEqual('string');
 | 
			
		||||
  expect(s1).toEqual(s2);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.start();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user