UNPKG

xero-hero

Version:

Heroic utilities to simplify and enable your progress with the [xero-node](https://www.npmjs.com/package/xero-node) SDK.

40 lines (38 loc) 1.04 kB
// src/common/instance/operations.ts import { isObject } from "deep-cuts"; var deepClone = (instance) => { if (instance && isObject(instance)) { const { constructor } = instance; const clone = new constructor(); for (const key in instance) { clone[key] = deepClone(instance[key]); } return clone; } return instance; }; // src/common/response/selectors.ts var getListFromResponse = (response) => { if (response.body) { const propertyName = Object.getOwnPropertyNames(response.body); for (const name of propertyName) { if (Array.isArray(response.body[name])) { return response.body[name]; } } } return void 0; }; // src/common/where/generators.ts var dateInWhereFormat = (date) => { if (date) { return `DateTime(${date.getFullYear()}, ${date.getMonth() + 1}, ${date.getDate()})`; } throw new Error("You must pass in a valid JavaScript Date object."); }; export { dateInWhereFormat, deepClone, getListFromResponse }; //# sourceMappingURL=index.mjs.map