Sha256: 2cb61ba1d76acb67df5532f0c7188b061a1a63ce7b2711e9dae882ba3ad3f509

Contents?: true

Size: 887 Bytes

Versions: 1

Compression:

Stored size: 887 Bytes

Contents

export function pluralize(kind) {
    if (kind[kind.length-1] === 'y') {
        return kind.slice(0, kind.length-1) + 'ies';
    } else if (kind[kind.length - 1] !== 's') {
        return kind + 's';
    } else {
        return kind;
    }
}

// http://www.quirksmode.org/js/cookies.html
export function readCookie(name) {
    const nameEQ = name + '=',
          ca = document.cookie.split(';');

    for (let i = 0; i < ca.length; i++) {
        let c = ca[i];

        while (c.charAt(0) === ' ') {
            c = c.substring(1, c.length);
        }

        if (c.indexOf(nameEQ) === 0) {
            return window.decodeURIComponent(
                c.substring(nameEQ.length, c.length));
        }
    }

    return null;
}

export function getTabname(header, set) {
    if (!set || !set.length) {
        return `${header} (0)`;
    }

    return `${header} (${set.length})`;
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conjur-asset-ui-1.6.0 app/src/utils.js