BeameryHQ/Ditto

View on GitHub
ditto/plugins/parseString.js

Summary

Maintainability
A
0 mins
Test Coverage
'use strict';

/**
 * @function parseString
 * @description Convert a value into a string by concatenating it with an empty space
 * Known issue is that we will lose double precision when converting to string (check the tests)
 *
 * @param {String} source the string we wish to transform
 * @returns {String}
 */
function parseString(source) {

    return (typeof(source) === "boolean" || !!source) ? "" + source : null;

}

module.exports = parseString;