-
Notifications
You must be signed in to change notification settings - Fork 7.1k
/
GetBoolean.js
35 lines (33 loc) · 896 Bytes
/
GetBoolean.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* @author Richard Davey <rich@phaser.io>
* @copyright 2013-2024 Phaser Studio Inc.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* Retrieves the value of the given key from an object.
*
* @function Phaser.Tweens.Builders.GetBoolean
* @since 3.0.0
*
* @param {object} source - The object to retrieve the value from.
* @param {string} key - The key to look for in the `source` object.
* @param {boolean} defaultValue - The default value to return if the `key` doesn't exist or if no `source` object is provided.
*
* @return {boolean} The retrieved value.
*/
var GetBoolean = function (source, key, defaultValue)
{
if (!source)
{
return defaultValue;
}
else if (source.hasOwnProperty(key))
{
return source[key];
}
else
{
return defaultValue;
}
};
module.exports = GetBoolean;