All files Part.js

100% Statements 14/14
100% Branches 10/10
100% Functions 6/6
100% Lines 14/14
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    16959x       17785x       73x       12792x 12792x       6395x 718x   5677x 3169x   2508x 2508x       159x 159x 159x      
export default class Part {
    constructor (rawValue) {
        this._value = ((rawValue || '') + '') || null;
    }
 
    isEmpty () {
        return this._value === null;
    }
 
    isCaseSensitive () {
        return true;
    }
 
    toString () {
        const rawValue = (this._value || '') + '';
        return rawValue;
    }
 
    toLowerCase (condition) {
        if (!condition) {
            return this;
        }
        if (this.isEmpty()) {
            return this;
        }
        const PartConstructor = this.constructor;
        return new PartConstructor(this._value.toLowerCase());
    }
 
    static isEqual (part1, part2) {
        part1 = part1.toString().toLowerCase();
        part2 = part2.toString().toLowerCase();
        return part1 === part2;
    }
}