(props: {[key: string]: any}, key: string)
| 8 | import {emailInString} from "../data/DataUtils"; |
| 9 | |
| 10 | export function getPropertyValueArrayOrEmpty(props: {[key: string]: any}, key: string) { |
| 11 | if (!(key in props)) { |
| 12 | return []; |
| 13 | } |
| 14 | const prop = props[key]; |
| 15 | // each property is an array of two elements: property value and source |
| 16 | if (!Array.isArray(prop) || prop.length !== 2) { |
| 17 | return []; |
| 18 | } |
| 19 | const value = prop[0]; |
| 20 | if (!Array.isArray(value)) { |
| 21 | return []; |
| 22 | } |
| 23 | return value; |
| 24 | } |
| 25 | |
| 26 | export function getPropertyValueOrDefault(props: {[key: string]: any}, key: string, def: any) { |
| 27 | if (!(key in props)) { |
no outgoing calls
no test coverage detected