MCPcopy
hub / github.com/phaserjs/phaser / GetAdvancedValue

Function GetAdvancedValue

src/utils/object/GetAdvancedValue.js:52–81  ·  view source on GitHub ↗
(source, key, defaultValue)

Source from the content-addressed store, hash-verified

50 * @return {*} The value of the requested key.
51 */
52var GetAdvancedValue = function (source, key, defaultValue)
53{
54 var value = GetValue(source, key, null);
55
56 if (value === null)
57 {
58 return defaultValue;
59 }
60 else if (Array.isArray(value))
61 {
62 return MATH.RND.pick(value);
63 }
64 else if (typeof value === 'object')
65 {
66 if (value.hasOwnProperty('randInt'))
67 {
68 return MATH.RND.integerInRange(value.randInt[0], value.randInt[1]);
69 }
70 else if (value.hasOwnProperty('randFloat'))
71 {
72 return MATH.RND.realInRange(value.randFloat[0], value.randFloat[1]);
73 }
74 }
75 else if (typeof value === 'function')
76 {
77 return value(key);
78 }
79
80 return value;
81};
82
83module.exports = GetAdvancedValue;

Callers 15

TweenBuilderFunction · 0.85
TweenChainBuilderFunction · 0.85
NumberTweenBuilderFunction · 0.85
BuildGameObjectFunction · 0.85
BuildGameObjectAnimationFunction · 0.85
BlitterCreator.jsFile · 0.85
Mesh2DCreator.jsFile · 0.85
ImageCreator.jsFile · 0.85

Calls 1

GetValueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…