Brought in another asset for Ray's eye form: moment
[openemr.git] / public / assets / moment-2-13-0 / src / lib / locale / set.js
blob1fd1389024fe2fbcfed0ccd507b8e06f01c9a642
1 import isFunction from '../utils/is-function';
2 import extend from '../utils/extend';
3 import isObject from '../utils/is-object';
4 import hasOwnProp from '../utils/has-own-prop';
6 export function set (config) {
7     var prop, i;
8     for (i in config) {
9         prop = config[i];
10         if (isFunction(prop)) {
11             this[i] = prop;
12         } else {
13             this['_' + i] = prop;
14         }
15     }
16     this._config = config;
17     // Lenient ordinal parsing accepts just a number in addition to
18     // number + (possibly) stuff coming from _ordinalParseLenient.
19     this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source);
22 export function mergeConfigs(parentConfig, childConfig) {
23     var res = extend({}, parentConfig), prop;
24     for (prop in childConfig) {
25         if (hasOwnProp(childConfig, prop)) {
26             if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
27                 res[prop] = {};
28                 extend(res[prop], parentConfig[prop]);
29                 extend(res[prop], childConfig[prop]);
30             } else if (childConfig[prop] != null) {
31                 res[prop] = childConfig[prop];
32             } else {
33                 delete res[prop];
34             }
35         }
36     }
37     return res;