git.schokokeks.org
Repositories
Help
Report an Issue
fs-words.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
6e9c872
Branches
Tags
develop-client_server
master
typescript
fs-words.git
server
lib
node_modules
fast-json-stable-stringify
test
cmp.js
[add] server:lib:node_modules
Christian Fraß
commited
6e9c872
at 2021-03-08 23:52:07
cmp.js
Blame
History
Raw
'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}'); });