UNPKG

@modern-js/runtime-utils

Version:

A Progressive React Framework for modern web development.

18 lines (17 loc) 489 B
import "node:module"; function createRequestContext(context) { const _context = context || new Map(); function get(key) { if ('string' == typeof key) return _context.get(key); return _context.get(key.symbol) || key.getDefaultValue(); } function set(key, value) { if ('string' == typeof key) _context.set(key, value); else _context.set(key.symbol, value); } return { set, get }; } export { createRequestContext };