UNPKG

ntms

Version:

A dead simple way to add i18n to your Next.js app using the Notion API and Deepl

18 lines (17 loc) 614 B
const mapSeries = (iterable: any, mapper: any): Promise<any> => { var reducer: any; var initial: any; return Promise.all(iterable).then( ((reducer = (results: any, value: any, key: any, values: any) => Promise.resolve(value) .then((resolved) => mapper(resolved, key, values)) .then((resolved) => (results.push(resolved), results))), (initial = []), (iterable) => iterable.reduce( (chain: Promise<any>, value, key) => chain.then((results) => reducer(results, value, key, iterable)), Promise.resolve(initial), )), ); }; export default mapSeries;