'use strict';

/**
 * Convert a string to camel case.
 *
 * @param  {String} string - The string.
 * @return {String}
 */
function camelCase(string) {
    if (typeof string !== 'string') {
        throw new Error('`camelCase`: first argument must be a string.');
    }

    // hyphen found after first character
    if (string.indexOf('-') > 0) {
        var strings = string.toLowerCase().split('-');

        // capitalize starting from the second string item
        for (var i = 1, len = strings.length; i < len; i++) {
            strings[i] = strings[i].charAt(0).toUpperCase() + strings[i].slice(1);
        }

        return strings.join('');
    }

    return string;
}

/**
 * Export utilties.
 */
module.exports = {
    camelCase: camelCase
};

Create utility helper for camel casing text with hyphens
Create utility helper for camel casing text with hyphens

This helper will be used when converting CSS styles to JS objects.
Then the `style` object will be consistent in the React props.
