UNPKG

jorel

Version:

A unified wrapper for working with LLMs from multiple providers, including streams, images, documents & automatic tool use.

31 lines (30 loc) 914 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.maskAll = exports.omit = void 0; exports.shallowFilterUndefined = shallowFilterUndefined; const omit = (obj, keys) => Object.keys(obj).reduce((acc, key) => { if (!keys.includes(key)) acc[key] = obj[key]; return acc; }, {}); exports.omit = omit; const maskAll = (obj) => { const copy = { ...obj }; for (const key in copy) { copy[key] = "********"; } return copy; }; exports.maskAll = maskAll; function shallowFilterUndefined(arg) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore return Object.keys(arg).reduce((acc, key) => { const _acc = acc; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore if (arg[key] !== undefined) _acc[key] = arg[key]; return _acc; }, {}); }