UNPKG

data-synchronizer

Version:

A versatile library for transferring data across multi-page applications or single page applications.

19 lines (16 loc) 412 B
const $type = 'asyncfunction'; const to = (value: Function) => { let funcString = value.toString(); if (!funcString.startsWith('async function')) { funcString = funcString.replace('async', 'async function'); } return [ $type, funcString, ]; } const from = (value: string) => { const arrowFunc = new Function(`return ${value}`); return arrowFunc(); } export default [$type, from, to];