All files / src/modules phoneNumber.js

100% Statements 24/24
80% Branches 4/5
100% Functions 4/4
100% Lines 24/24

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 251x 1x 22x 22x 1x 1x 5x 5x 5x 5x 1x 1x 1x 3x 3x 3x 3x 3x 3x 1x 1x 5x 5x 1x  
export class Phone {
  constructor(pure) {
    this.pure = pure;
  }
 
  phoneNumber(format) {
    const def = format || this.pure.phone.phoneFormats();
 
    return this.pure.helpers.replaceSymbolWithNumber({ string: def });
  }
 
  // TODO: this is strange passing in an array index.
  phoneNumberFormat(phoneFormatsArrayIndex) {
    const format = phoneFormatsArrayIndex || 0;
 
    return this.pure.helpers.replaceSymbolWithNumber({
      string: this.pure.registeredModules.phoneNumber.formats[format]
    });
  }
 
  phoneFormats() {
    return this.pure.random.arrayElement(this.pure.registeredModules.phoneNumber.formats);
  }
}