UNPKG

verb

Version:

Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.

22 lines (16 loc) 543 B
'use strict'; var path = require('path'); var utils = require('../utils'); /** * Ensure that `ext` is on the file object. */ module.exports = function(file, next) { if (!file.hasOwnProperty('data')) { throw new Error('ext middleware: file object should have a `data` property.'); } if (!file.data.hasOwnProperty('src')) { throw new Error('ext middleware: file.data object should have a `src` property.'); } file.ext = file.ext ? utils.formatExt(file.ext) : (file.data.src.ext || path.extname(file.path)); next(); };