@infosel-sdk/core
Version:
Core SDK for Infosel financial services platform. Provides essential infrastructure for authentication, HTTP/GraphQL communication, storage management, and error handling.
24 lines • 865 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.queryfy = void 0;
const queryfy = (obj) => {
// Make sure we don't alter numbers or strings.
if (typeof obj === 'number' || typeof obj === 'string') {
return obj;
}
// If the obj is an Array then map queryfy each item
// inside of `[``]`
if (Array.isArray(obj)) {
return `[${obj.map(item => (0, exports.queryfy)(item)).join(',')}]`;
}
// Iterate through object keys to convert into a string
// to be interpolated into the query.
const props = Object.keys(obj)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
.map(key => `${key}:${(0, exports.queryfy)(obj[key])}`)
.join(',');
return `{${props}}`;
};
exports.queryfy = queryfy;
//# sourceMappingURL=query.js.map