Buckets:
ktongue/docker_container / .cache /opencode /node_modules /fast-json-stringify /test /nestedObjects.test.js
| const { test } = require('node:test') | |
| const build = require('..') | |
| test('nested objects with same properties', (t) => { | |
| t.plan(1) | |
| const schema = { | |
| title: 'nested objects with same properties', | |
| type: 'object', | |
| properties: { | |
| stringProperty: { | |
| type: 'string' | |
| }, | |
| objectProperty: { | |
| type: 'object', | |
| additionalProperties: true | |
| } | |
| } | |
| } | |
| const stringify = build(schema) | |
| const value = stringify({ | |
| stringProperty: 'string1', | |
| objectProperty: { | |
| stringProperty: 'string2', | |
| numberProperty: 42 | |
| } | |
| }) | |
| t.assert.equal(value, '{"stringProperty":"string1","objectProperty":{"stringProperty":"string2","numberProperty":42}}') | |
| }) | |
| test('names collision', (t) => { | |
| t.plan(1) | |
| const schema = { | |
| title: 'nested objects with same properties', | |
| type: 'object', | |
| properties: { | |
| test: { | |
| type: 'object', | |
| properties: { | |
| a: { type: 'string' } | |
| } | |
| }, | |
| tes: { | |
| type: 'object', | |
| properties: { | |
| b: { type: 'string' }, | |
| t: { type: 'object' } | |
| } | |
| } | |
| } | |
| } | |
| const stringify = build(schema) | |
| const data = { | |
| test: { a: 'a' }, | |
| tes: { b: 'b', t: {} } | |
| } | |
| t.assert.equal(stringify(data), JSON.stringify(data)) | |
| }) | |
Xet Storage Details
- Size:
- 1.3 kB
- Xet hash:
- a4c78ebfef433e267e9b7f909040f31e425db03e8118143acf9a642c8ab997bf
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.