File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 1- var through2 = require ( 'through2' ) ;
2- var reg = / r e q u i r e \( [ " ' ] p o w e r - a s s e r t [ " ' ] \) / g;
1+ const { Transform } = require ( "stream" ) ;
2+ const reg = / r e q u i r e \( [ " ' ] p o w e r - a s s e r t [ " ' ] \) / g;
33
44function modifier ( str ) {
55 // power-assert -> assert
66 // strict use strict
7- return str . replace ( reg , ' require("assert")' ) . replace ( / [ " ' ] u s e s t r i c t [ " ' ] ; ? \n / g, "" )
7+ return str . replace ( reg , " require(\ "assert\")" ) . replace ( / [ " ' ] u s e s t r i c t [ " ' ] ; ? \n / g, "" ) ;
88}
99
1010function modify ( ) {
11- return through2 . obj ( function ( file , encoding , done ) {
12- var content = modifier ( String ( file . contents ) ) ;
13- file . contents = new Buffer ( content ) ;
14- this . push ( file ) ;
15- done ( ) ;
11+ return new Transform ( {
12+ objectMode : true ,
13+ transform ( file , encoding , callback ) {
14+ const content = modifier ( String ( file . contents ) ) ;
15+ file . contents = Buffer . from ( content ) ;
16+ this . push ( file ) ;
17+ callback ( ) ;
18+ }
1619 } ) ;
1720}
1821
Original file line number Diff line number Diff line change 6868 "textlint-plugin-asciidoctor" : " ^1.0.3" ,
6969 "textlint-rule-eslint" : " 4.0.1" ,
7070 "textlint-rule-prh" : " ^5.2.1" ,
71- "through2" : " ^3.0.1" ,
7271 "vinyl-source-stream" : " ^2.0.0"
7372 }
7473}
You can’t perform that action at this time.
0 commit comments