MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / getSetGlobalLocale

Function getSetGlobalLocale

tests/test_code/js/moment/moment.js:2106–2129  ·  view source on GitHub ↗
(key, values)

Source from the content-addressed store, hash-verified

2104 // no arguments are passed in, it will simply return the current global
2105 // locale key.
2106 function getSetGlobalLocale(key, values) {
2107 var data;
2108 if (key) {
2109 if (isUndefined(values)) {
2110 data = getLocale(key);
2111 } else {
2112 data = defineLocale(key, values);
2113 }
2114
2115 if (data) {
2116 // moment.duration._locale = moment._locale = data;
2117 globalLocale = data;
2118 } else {
2119 if (typeof console !== 'undefined' && console.warn) {
2120 //warn user if arguments are passed but the locale could not be set
2121 console.warn(
2122 'Locale ' + key + ' not found. Did you forget to load it?'
2123 );
2124 }
2125 }
2126 }
2127
2128 return globalLocale._abbr;
2129 }
2130
2131 function defineLocale(name, config) {
2132 if (config !== null) {

Callers 4

loadLocaleFunction · 0.85
defineLocaleFunction · 0.85
updateLocaleFunction · 0.85
moment.jsFile · 0.85

Calls 3

isUndefinedFunction · 0.85
getLocaleFunction · 0.85
defineLocaleFunction · 0.85

Tested by

no test coverage detected