scripts/core/augmented.js
function(source, type) {
        var out = null;
        switch(type) {
          case Augmented.Utility.TransformerType.xString:
          if (typeof source === 'object') {
            out = JSON.stringify(source);
          } else {
            out = String(source);
          }
          break;
          case Augmented.Utility.TransformerType.xInteger:
          out = parseInt(source);
          break;
          case Augmented.Utility.TransformerType.xNumber:
          out = Number(source);
          break;
          case Augmented.Utility.TransformerType.xBoolean:
          out = Boolean(source);
          break;
          case Augmented.Utility.TransformerType.xArray:
          if (!Array.isArray(source)) {
            out = [];
            out[0] = source;
          } else {
            out = source;
          }
          break;
          case Augmented.Utility.TransformerType.xObject:
          if (typeof source !== 'object') {
            out = {};
            out[source] = source;
          } else {
            out = source;
          }
          break;
        }
        return out;
      }
function(source, type) {
        var out = null;
        switch(type) {
          case Augmented.Utility.TransformerType.xString:
          if (typeof source === 'object') {
            out = JSON.stringify(source);
          } else {
            out = String(source);
          }
          break;
          case Augmented.Utility.TransformerType.xInteger:
          out = parseInt(source);
          break;
          case Augmented.Utility.TransformerType.xNumber:
          out = Number(source);
          break;
          case Augmented.Utility.TransformerType.xBoolean:
          out = Boolean(source);
          break;
          case Augmented.Utility.TransformerType.xArray:
          if (!Array.isArray(source)) {
            out = [];
            out[0] = source;
          } else {
            out = source;
          }
          break;
          case Augmented.Utility.TransformerType.xObject:
          if (typeof source !== 'object') {
            out = {};
            out[source] = source;
          } else {
            out = source;
          }
          break;
        }
        return out;
      }
function ( source , type ) { var out = null ; switch ( type ) { case Augmented . Utility . TransformerType . xString : if ( typeof source === 'object' ) { out = JSON . stringify ( source ) ; } else { out = String ( source ) ; } break ; case Augmented . Utility . TransformerType . xInteger : out = parseInt ( source ) ; break ; case Augmented . Utility . TransformerType . xNumber : out = Number ( source ) ; break ; case Augmented . Utility . TransformerType . xBoolean : out = Boolean ( source ) ; break ; case Augmented . Utility . TransformerType . xArray : if ( ! Array . isArray ( source ) ) { out = [ ] ; out [ 0 ] = source ; } else { out = source ; } break ; case Augmented . Utility . TransformerType . xObject : if ( typeof source !== 'object' ) { out = { } ; out [ source ] = source ; } else { out = source ; } break ; } return out ; }
Transform an object, primitive, or array to another object, primitive, or array
@method transform
@param {object} source Source primitive to transform
@param {Augmented.Utility.TransformerType} type Type to transform to
@memberof Augmented.Utility.Transformer
@returns {object} returns a transformed object or primitive
Transform an object primitive or array to another object primitive or array