diff --git a/src/json.js b/src/json.js index d7c8ae7..a15f500 100644 --- a/src/json.js +++ b/src/json.js @@ -163,37 +163,9 @@ const createObject = (obj, depth, currentKey, opts = {}) => { * Create JSON from promises without extracting functions or multiple await * * This can also create special JSON with spreaded values instead of keyed values. - * This function is used alongside {@link spread} function - * ```js - * const props = jjson({ - * [spread()]: buildUserDetails(), - * }) - * ``` - * - * This will result in: - * ``` - * { - * id: 123, - * username: 'abumq' - * } - * ``` - * whereas if we were to use usual `json()` - * ```js - * const props = json({ - * user: buildUserDetails(), - * }) - * ``` - * that would result in - * ``` - * { - * user: { - * id: 123, - * username: 'abumq' - * } - * } - * ``` + * (see [spread operator](https://github.com/abumq/airsync#spread-operator)) * @param {*} val Object or Array - * @param {*} opts AirSync options. See https://github.com/abumq/airsync/tree/main#options + * @param {*} opts AirSync options. See [options](https://github.com/abumq/airsync#options) * @returns Resulting JSON */ const json = (val, opts = {}) => { diff --git a/tests/spread.js b/tests/spread.js index 9dd1157..6dbfa05 100644 --- a/tests/spread.js +++ b/tests/spread.js @@ -1,9 +1,15 @@ const assert = require('assert'); const airsync = require('../src'); - const { queryPerson, queryProfile } = require('./utils'); -describe('When we have JSON', async () => { +const RACE_NUMBERS = 100; + +const logger = { + startTime: console.log, + endTime: console.log, +} + +describe('When we have JSON with spread()', async () => { const buildProps = () => { @@ -19,6 +25,7 @@ describe('When we have JSON', async () => { } const props = await buildProps(); + // console.log(props) it('the JSON correctly spreads the properties', () => { assert.equal(props.name, 'John');