Code coverage report for src/stringUtils.js

Statements: 100% (10 / 10)      Branches: 50% (1 / 2)      Functions: 100% (4 / 4)      Lines: 100% (9 / 9)      Ignored: none     

All files » src/ » stringUtils.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  1           1 14             1 7             1 9 9       1        
'use strict';
var _ = require('lodash');
 
/**
 * @param {string} str
 * @return {string}
 */
function convertToCamelCase(str) {
    return str.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
}
 
/**
 * @param {string} str
 * @return {string}
 */
function capitalize(str) {
    return str[0].toUpperCase() + str.slice(1);
}
 
/**
 * @param {Array.<*>} array
 * @param {*} obj
 */
function addIfNotThere(array, obj) {
    Eif (!_.contains(array, obj)) {
        array.push(obj);
    }
}
 
module.exports = {
    convertToCamelCase: convertToCamelCase,
    capitalize: capitalize,
    addIfNotThere: addIfNotThere
};