Sha256: ebfe070bd31b66bf556526c90640e1880a9cd12549946f2dc140917daa84c222
Contents?: true
Size: 574 Bytes
Versions: 140
Compression:
Stored size: 574 Bytes
Contents
var test = require('tape'); var stringify = require('../'); test('toJSON function', function (t) { t.plan(1); var obj = { one: 1, two: 2, toJSON: function() { return { one: 1 }; } }; t.equal(stringify(obj), '{"one":1}' ); }); test('toJSON returns string', function (t) { t.plan(1); var obj = { one: 1, two: 2, toJSON: function() { return 'one'; } }; t.equal(stringify(obj), '"one"'); }); test('toJSON returns array', function (t) { t.plan(1); var obj = { one: 1, two: 2, toJSON: function() { return ['one']; } }; t.equal(stringify(obj), '["one"]'); });
Version data entries
140 entries across 97 versions & 10 rubygems