vinyl-named2
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

vinyl-named2

Release Version License

Give vinyl files arbitrary chunk names, using through2, with type declarations.

Usage

const named = require('vinyl-named2');
const fs = require('vinyl-fs');
const through = require('through2');

fs.src('src/*.js')
  .pipe(named())
  .pipe(through.obj((file) => {
    // file.named now equals the basename minus the extension.
  }));

// Or, return a name for a given file.
fs.src('src/*.js')
  .pipe(named((file) => 'your own name'));

// Or, specify a custom name property.
fs.src('src/*.js')
  .pipe(named(function (file) {
    file.customName = 'your name';
    this.push(file);
  }));

TypeScript

import named from 'vinyl-named2';
import * as fs from 'vinyl-fs';
import * as through from 'through2';

fs.src('src/*.js')
  .pipe(named())
  .pipe(through.obj((file) => {
    // file.named now equals the basename minus the extension.
  }));

// Or, return a name for a given file.
fs.src('src/*.js')
  .pipe(named((file) => 'your own name'));

// Or, specify a custom name property.
fs.src('src/*.js')
  .pipe(named(function (this, file) {
    file.customName = 'your name';
    this.push(file);
  }));

Readme

Keywords

Package Sidebar

Install

npm i vinyl-named2

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.28 kB

Total Files

5

Last publish

Collaborators

  • roydukkey