lib/index.js
function check(files, file, pattern, def) {
    let data = files[file];
    
    // Only process utf8 encoded files (so no binary)
    if (!utf8(data.contents)) {
      return false;
    }
    
    // Only process files that match the pattern (if there is a pattern)
    if (pattern && !match(file, pattern)[0]) {
      return false;
    }
    
    // Only process files with a specified layout or default template.
    // Allow the default template to be cancelled by layout: false.
    return 'layout' in data ? data.layout : def;
  }
function check(files, file, pattern, def) {
    let data = files[file];
    
    // Only process utf8 encoded files (so no binary)
    if (!utf8(data.contents)) {
      return false;
    }
    
    // Only process files that match the pattern (if there is a pattern)
    if (pattern && !match(file, pattern)[0]) {
      return false;
    }
    
    // Only process files with a specified layout or default template.
    // Allow the default template to be cancelled by layout: false.
    return 'layout' in data ? data.layout : def;
  }
function check ( files , file , pattern , def ) { let data = files [ file ] ; // Only process utf8 encoded files (so no binary) if ( ! utf8 ( data . contents ) ) { return false ; } // Only process files that match the pattern (if there is a pattern) if ( pattern && ! match ( file , pattern ) [ 0 ] ) { return false ; } // Only process files with a specified layout or default template. // Allow the default template to be cancelled by layout: false. return 'layout' in data ? data . layout : def ; }
Test if file has layout front-matter or matches pattern with default layout

Code source:
https://github.com/superwolff/metalsmith-layouts/blob/master/lib/helpers/check.js

@param {Object} files
@param {String} file
@param {String} pattern
@param {String} default
@return {Boolean}
Test if file has layout front - matter or matches pattern with default layout