UNPKG

@fourlights/mapper

Version:

A simple data mapper written in typescript

2 lines 1.03 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }function o(r,t,n){return`${_optionalChain([t, 'optionalAccess', _ => _.toString, 'call', _2 => _2()])}_${_optionalChain([n, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()])}`}function g(r,t,n){return`${_optionalChain([t, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()])}.${_optionalChain([n, 'optionalAccess', _7 => _7.toString, 'call', _8 => _8()])}`}exports.a = o; exports.b = g; //# sourceMappingURL=chunk-2FHHGQ5X.cjs.map