Files
med-notes/.pnpm-store/v10/files/2a/347c320821f77c5b0abdcf946214140098250d22fe4f901844114a1f394d2e8bc1972c12c76a91309e0efccbf142c244291812dd19c60d418f1ce6b4ec1f3b
2025-05-09 05:30:08 +02:00

14 lines
350 B
Plaintext

'use strict';
var test = require('tape');
var stringify = require('../');
test('custom comparison function', function (t) {
t.plan(1);
var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };
var s = stringify(obj, function (a, b) {
return a.key < b.key ? 1 : -1;
});
t.equal(s, '{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3}');
});