Skip to content

Commit

Permalink
[TIMOB-17000] Fixed bug where integer config values were being saved …
Browse files Browse the repository at this point in the history
…as strings instead of numbers.
  • Loading branch information
cb1kenobi committed May 20, 2014
1 parent 99a0bbd commit 3aae7ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -11,6 +11,7 @@
* Improved error handling when sdk command requests list of releases [TIMOB-16917]
* Fixed bug with prompting for missing or invalid options that use generic prompting
* Fixed sorting of Titanium SDKs in the 'sdk select' command to only list valid SDKs and order by their actual version number [TIMOB-16974]
* Fixed bug where integer config values were being saved as strings instead of numbers [TIMOB-17000]

3.2.3 (5/1/2014)
-------------------
Expand Down
7 changes: 5 additions & 2 deletions lib/config.js
Expand Up @@ -155,12 +155,15 @@ Object.defineProperty(config, 'set', {
} while (obj && (p = parts[i++]));
}

// if not an array, try to cast to null, true, false, or leave as string
// if not an array, try to cast to null, true, false, int or leave as string
if (!Array.isArray(value)) {
value = value == void 0 ? '' : value.toString().trim();
value = value === void 0 ? '' : String(value).trim();
value === 'null' && (value = null);
value === 'true' && (value = true);
value === 'false' && (value = false);
if (String(~~value) == value) {
value = ~~value;
}
}

if (obj && q) {
Expand Down

0 comments on commit 3aae7ee

Please sign in to comment.