packages/nodeppt-parser/lib/markdown/plus-list.js
function applyClass(token) {
    // init attributes
    token.attrs = token.attrs || [];

    // get index of class attribute
    let keys = token.attrs.map(arr => arr[0]);
    let idx = keys.indexOf('class');

    if (idx === -1) {
        // Add class attribute if not defined
        token.attrs.push(['class', className]);
    } else {
        // Get the current class list to append.
        // Watch out for duplicates
        let classStr = token.attrs[idx][1] || '';
        let classList = classStr.split(' ');

        // Add the class if we don't already have it
        if (classList.indexOf(className) === -1) {
            token.attrs[idx][1] = classStr += ' ' + className;
        }
    }
}
function applyClass(token) {
    // init attributes
    token.attrs = token.attrs || [];

    // get index of class attribute
    let keys = token.attrs.map(arr => arr[0]);
    let idx = keys.indexOf('class');

    if (idx === -1) {
        // Add class attribute if not defined
        token.attrs.push(['class', className]);
    } else {
        // Get the current class list to append.
        // Watch out for duplicates
        let classStr = token.attrs[idx][1] || '';
        let classList = classStr.split(' ');

        // Add the class if we don't already have it
        if (classList.indexOf(className) === -1) {
            token.attrs[idx][1] = classStr += ' ' + className;
        }
    }
}
function applyClass ( token ) { // init attributes token . attrs = token . attrs || [ ] ; // get index of class attribute let keys = token . attrs . map ( arr => arr [ 0 ] ) ; let idx = keys . indexOf ( 'class' ) ; if ( idx === - 1 ) { // Add class attribute if not defined token . attrs . push ( [ 'class' , className ] ) ; } else { // Get the current class list to append. // Watch out for duplicates let classStr = token . attrs [ idx ] [ 1 ] || '' ; let classList = classStr . split ( ' ' ) ; // Add the class if we don't already have it if ( classList . indexOf ( className ) === - 1 ) { token . attrs [ idx ] [ 1 ] = classStr += ' ' + className ; } } }
Adds class to token

@param {any} token
@param {string} className
Adds class to token