all files / js/ Support.class.js

100% Statements 8/8
100% Branches 4/4
100% Functions 2/2
100% Lines 8/8
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 35 36 37 38 39 40                                20× 20×                 11×                
/**
 * @fileOverview Support Class.
 * @author Simon Gattner <npm@0x38.de>
 * @license MIT
 * @version 1.0.0
 * @module {es6} Support
 */
export default class Support {
    /**
     * Support check.
     * @class Support
     * @classdesc Class to check a Support.
     * @param {string} type to check.
     * @param {object} list to check against.
     */
    constructor(type, list) {
        this.type = type;
        this.list = list;
    }
 
    /**
     * Check Support of type against a list
     * @function Support.check
     * @return {boolean}
     */
    check() {
        if (!this.list || !this.list.supports) {
            return false;
        }
        try {
            return this.list.supports(this.type);
        } catch (event) {
            // eslint-disable-next-line no-console
            console.log('Support.check: error', event);
        }
        return false;
    }
}