UNPKG

@redwoodjs-stripe/api

Version:

API-side code for RedwoodJS-Stripe projects

14 lines (13 loc) 383 B
const lastStripeObject = (array) => { const latest = array.sort((first, next) => { const firstDate = /* @__PURE__ */ new Date(0); firstDate.setUTCSeconds(first.created); const nextDate = /* @__PURE__ */ new Date(0); nextDate.setUTCSeconds(next.created); return +firstDate - +nextDate; }); return latest[latest.length - 1]; }; export { lastStripeObject };