biofriction-wp-theme/node_modules/vinyl-named/index.js

18 lines
406 B
JavaScript
Raw Normal View History

2021-10-26 14:18:09 +02:00
var path = require('path')
var through = require('through')
module.exports = function(opts) {
return through(function(file) {
if (typeof opts === 'function') {
var res = opts.call(this, file)
if (res != null) {
file.named = res
this.queue(file)
}
} else {
file.named = path.basename(file.path, path.extname(file.path))
this.queue(file)
}
})
}