(
langs: string | LanguageDef[] | Record<string, any>,
key: string,
defaultValue?: PropertyValue,
fn?: (item: PropertyValue, language?: any) => unknown,
)
| 315 | ): Record<LanguageKey, R>; |
| 316 | |
| 317 | get( |
| 318 | langs: string | LanguageDef[] | Record<string, any>, |
| 319 | key: string, |
| 320 | defaultValue?: PropertyValue, |
| 321 | fn?: (item: PropertyValue, language?: any) => unknown, |
| 322 | ) { |
| 323 | const map_fn = fn || _.identity; |
| 324 | if (_.isEmpty(langs)) { |
| 325 | return map_fn(this.ceProps(key, defaultValue)); |
| 326 | } |
| 327 | if (isString(langs)) { |
| 328 | if (this.propsByLangId[langs]) { |
| 329 | return map_fn(this.$getInternal(langs, key, defaultValue), this.languages[langs]); |
| 330 | } |
| 331 | logger.error(`Tried to pass ${langs} as a language ID`); |
| 332 | return map_fn(defaultValue); |
| 333 | } |
| 334 | return _.chain(langs) |
| 335 | .map(lang => [lang.id, map_fn(this.$getInternal(lang.id, key, defaultValue), lang)]) |
| 336 | .object() |
| 337 | .value(); |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | export function setDebug(debug: boolean) { |
nothing calls this directly
no test coverage detected