All files / src/asset UnityAssetFile.ts

60% Statements 9/15
100% Branches 0/0
40% Functions 2/5
57.14% Lines 8/14

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 241x 1x 1x   1x     1x       1x 8x                   1x  
export default class UnityAssetFile {
  public static readonly metaExt: string = 'meta';
  public static readonly metaRegex: RegExp = new RegExp(`\.${UnityAssetFile.metaExt}$`);
 
  public static createWithMetaFile(metaFile: string): UnityAssetFile {
    return new UnityAssetFile(metaFile.replace(UnityAssetFile.metaRegex, ''), metaFile);
  }
  public static createWithAssetFile(assetFile: string): UnityAssetFile {
    return new UnityAssetFile(assetFile, `${assetFile}.${UnityAssetFile.metaExt}`);
  }
 
  public static isMetaFile(file: string): boolean {
    return UnityAssetFile.metaRegex.test(file);
  }
 
  public asset: string = '';
  public meta: string = '';
 
  constructor(assetFile: string, metaFile: string) {
    this.asset = assetFile;
    this.meta = metaFile;
  }
}