Socket
Socket
Sign inDemoInstall

gulp-jsfmt

Package Overview
Dependencies
123
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gulp-jsfmt

`gulp` task for `jsfmt`


Version published
Weekly downloads
2
Maintainers
1
Created
Weekly downloads
 

Readme

Source

gulp-jsfmt

gulp task for jsfmt

Installation

Install via npm:

npm install gulp-jsfmt --save-dev

Usage

rewrite(opts, pattern1, pattern2, ...), rewrite(opts, [pattern1, pattern2, ...]), rewrite(pattern1, pattern2, ...), rewrite([pattern1, pattern2, ...])

var gulp = require('gulp');
var jsfmt  = require('gulp-jsfmt');

gulp.task('default', function() {
  gulp.src('./**/*.js')
    .pipe(jsfmt.rewrite('_.each(a, b) -> a.forEach(b)', '_.reduce(a, b, c) -> a.reduce(b, c)'))
    .pipe(gulp.dest('./dist'));
});

search(opts, pattern1, pattern2, ...), search(opts, [pattern1, pattern2, ...]), search(pattern1, pattern2, ...), search([pattern1, pattern2, ...])

var gulp = require('gulp');
var jsfmt  = require('gulp-jsfmt');
var through = require('through2');

gulp.task('default', function() {
  gulp.src('./**/*.js')
    .pipe(jsfmt.search('_.each(a, b)', '_.reduce(a, b, c)'))
    .pipe(through.obj(file, _, cb) {
      file.matches.forEach(function(matches, wildcards) {
        console.log(wildcards.z);
      });
    })
});

format()

Formats js (not JSON) files

var gulp = require('gulp');
var jsfmt  = require('gulp-jsfmt');

gulp.task('default', function() {
  gulp.src('./**/*.js')
    .pipe(jsfmt.format())
    .pipe(gulp.dest('./dist'));
});

formatJSON()

Formats json (not JS) files

var gulp = require('gulp');
var jsfmt  = require('gulp-jsfmt');

gulp.task('default', function() {
  gulp.src('./**/*.json')
    .pipe(jsfmt.formatJSON())
    .pipe(gulp.dest('./dist'));
});
matches

Each patterns specified will be used to call jsfmt.search, and the results are passed back in the property named matches in each of the Vinyl object in the stream.

Changelog

v0.1.0 expose search function v0.0.1 expose rewrite function

License

MIT

Keywords

FAQs

Last updated on 30 Sep 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc