MCPcopy
hub / github.com/date-fns/date-fns / setDefaultOptions

Function setDefaultOptions

pkgs/core/src/setDefaultOptions/index.ts:52–77  ·  view source on GitHub ↗
(options: DefaultOptions)

Source from the content-addressed store, hash-verified

50 * //=> Sun Aug 31 2014 00:00:00
51 */
52export function setDefaultOptions(options: DefaultOptions): void {
53 const result: DefaultOptions = {};
54 const defaultOptions = getDefaultOptions();
55
56 for (const property in defaultOptions) {
57 if (Object.prototype.hasOwnProperty.call(defaultOptions, property)) {
58 // [TODO] I challenge you to fix the type
59 (result as any)[property] =
60 defaultOptions[property as keyof DefaultOptions];
61 }
62 }
63
64 for (const property in options) {
65 if (Object.prototype.hasOwnProperty.call(options, property)) {
66 if (options[property as keyof DefaultOptions] === undefined) {
67 // [TODO] I challenge you to fix the type
68 delete (result as any)[property];
69 } else {
70 // [TODO] I challenge you to fix the type
71 (result as any)[property] = options[property as keyof DefaultOptions];
72 }
73 }
74 }
75
76 setInternalDefaultOptions(result);
77}

Callers 2

test.tsFile · 0.90
test.tsFile · 0.90

Calls 1

getDefaultOptionsFunction · 0.90

Tested by

no test coverage detected