|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
350 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var test = require('tape');
|
|---|
| 4 | var stringify = require('../');
|
|---|
| 5 |
|
|---|
| 6 | test('custom comparison function', function (t) {
|
|---|
| 7 | t.plan(1);
|
|---|
| 8 | var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };
|
|---|
| 9 | var s = stringify(obj, function (a, b) {
|
|---|
| 10 | return a.key < b.key ? 1 : -1;
|
|---|
| 11 | });
|
|---|
| 12 | t.equal(s, '{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3}');
|
|---|
| 13 | });
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.