spec/helpers/various-utils.js
function propertiesToDataAttributes ( attributesHash ) {
    var transformed = {};

    $.each( attributesHash, function ( key, value ) {
        // Convert camelCase to dashed notation, then add the "data-" prefix
        key = "data-" + toDashed( key );

        if ( $.isPlainObject( value ) ) value = JSON.stringify( value );

        transformed[key] = value;
    } );

    return transformed;
}
function propertiesToDataAttributes ( attributesHash ) {
    var transformed = {};

    $.each( attributesHash, function ( key, value ) {
        // Convert camelCase to dashed notation, then add the "data-" prefix
        key = "data-" + toDashed( key );

        if ( $.isPlainObject( value ) ) value = JSON.stringify( value );

        transformed[key] = value;
    } );

    return transformed;
}
Transforms a hash of Javascript properties into a HTML5 data-* attributes hash. Is the inverse function of
`dataAttributesToProperties()`.

@param   {Object} attributesHash
@returns {Object}