Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
20 lines
390 B
JavaScript
Executable file
20 lines
390 B
JavaScript
Executable file
define(function(require, exports, module) {
|
|
'use strict';
|
|
|
|
var NUMERIC = /^[0-9]+$/;
|
|
|
|
/**
|
|
* @param {number|string} id Some id.
|
|
*/
|
|
module.exports = function(id) {
|
|
// by an unfortunate decision we have both
|
|
// string ids and number ids.. based on the
|
|
// input we run parseInt
|
|
if (typeof id === 'string' && id.match(NUMERIC)) {
|
|
return parseInt(id, 10);
|
|
}
|
|
|
|
return id;
|
|
};
|
|
|
|
});
|