UNPKG

486 BJavaScriptView Raw
1import { endpointWithDefaults } from "./endpoint-with-defaults.js";
2import { merge } from "./merge.js";
3import { parse } from "./parse.js";
4function withDefaults(oldDefaults, newDefaults) {
5 const DEFAULTS = merge(oldDefaults, newDefaults);
6 const endpoint = endpointWithDefaults.bind(null, DEFAULTS);
7 return Object.assign(endpoint, {
8 DEFAULTS,
9 defaults: withDefaults.bind(null, DEFAULTS),
10 merge: merge.bind(null, DEFAULTS),
11 parse
12 });
13}
14export {
15 withDefaults
16};