(source, key, defaultValue)
| 17 | * @return {*} The value if found; otherwise, defaultValue (null if none provided) |
| 18 | */ |
| 19 | var GetFastValue = function (source, key, defaultValue) |
| 20 | { |
| 21 | var t = typeof(source); |
| 22 | |
| 23 | if (!source || t === 'number' || t === 'string') |
| 24 | { |
| 25 | return defaultValue; |
| 26 | } |
| 27 | else if (source.hasOwnProperty(key) && source[key] !== undefined) |
| 28 | { |
| 29 | return source[key]; |
| 30 | } |
| 31 | else |
| 32 | { |
| 33 | return defaultValue; |
| 34 | } |
| 35 | }; |
| 36 | |
| 37 | module.exports = GetFastValue; |
no outgoing calls
no test coverage detected
searching dependent graphs…