dist/src/http.js
function hydrateDates(body) {
    /**
     * Hydrates a string date to a Date object. Mutates input.
     * @param item object potentially containing a meta object
     */
    function hydrateMeta(item) {
        const meta = item.meta;
        if (meta && meta.created) {
            // parse ISO-8601 string to Date
            meta.created = new Date(meta.created);
        }
    }
    if (Array.isArray(body.data)) {
        // paginated response
        for (const item of body.data) {
            hydrateMeta(item);
        }
    }
    else {
        // object response
        hydrateMeta(body);
    }
    return body;
}
function hydrateDates(body) {
    /**
     * Hydrates a string date to a Date object. Mutates input.
     * @param item object potentially containing a meta object
     */
    function hydrateMeta(item) {
        const meta = item.meta;
        if (meta && meta.created) {
            // parse ISO-8601 string to Date
            meta.created = new Date(meta.created);
        }
    }
    if (Array.isArray(body.data)) {
        // paginated response
        for (const item of body.data) {
            hydrateMeta(item);
        }
    }
    else {
        // object response
        hydrateMeta(body);
    }
    return body;
}
function hydrateDates ( body ) { /**
     * Hydrates a string date to a Date object. Mutates input.
     * @param item object potentially containing a meta object
     */ function hydrateMeta ( item ) { const meta = item . meta ; if ( meta && meta . created ) { // parse ISO-8601 string to Date meta . created = new Date ( meta . created ) ; } } if ( Array . isArray ( body . data ) ) { // paginated response for ( const item of body . data ) { hydrateMeta ( item ) ; } } else { // object response hydrateMeta ( body ) ; } return body ; }
Hydrates dates in response bodies. Handles paginated responses and object responses.
Mutates input.
@param body HTTP response body
Hydrates dates in response bodies . Handles paginated responses and object responses . Mutates input .