File tree Expand file tree Collapse file tree 2 files changed +28
-7
lines changed Expand file tree Collapse file tree 2 files changed +28
-7
lines changed Original file line number Diff line number Diff line change 11/* eslint-disable vars-on-top, no-var, prefer-template */
2- var isRegExp = require ( 'lodash/isRegExp' ) ;
3- var escapeRegExp = require ( 'lodash/escapeRegExp' ) ;
4- var isString = require ( 'lodash/isString' ) ;
5- var flatten = require ( 'lodash/flatten' ) ;
2+ var isRegExp = function ( re ) {
3+ return re instanceof RegExp ;
4+ } ;
5+ var escapeRegExp = function escapeRegExp ( string ) {
6+ var reRegExpChar = / [ \\ ^ $ . * + ? ( ) [ \] { } | ] / g,
7+ reHasRegExpChar = RegExp ( reRegExpChar . source ) ;
8+
9+ return ( string && reHasRegExpChar . test ( string ) )
10+ ? string . replace ( reRegExpChar , '\\$&' )
11+ : string ;
12+ } ;
13+ var isString = function ( value ) {
14+ return typeof value === 'string' ;
15+ } ;
16+ var flatten = function ( array ) {
17+ var newArray = [ ] ;
18+
19+ array . forEach ( function ( item ) {
20+ if ( Array . isArray ( item ) ) {
21+ newArray = newArray . concat ( item ) ;
22+ } else {
23+ newArray . push ( item ) ;
24+ }
25+ } ) ;
26+
27+ return newArray ;
28+ } ;
629
730/**
831 * Given a string, replace every substring that is matched by the `match` regex
Original file line number Diff line number Diff line change 3131 " string" ,
3232 " replace"
3333 ],
34- "dependencies" : {
35- "lodash" : " ^4.17.4"
36- },
34+ "dependencies" : {},
3735 "devDependencies" : {
3836 "ava" : " ^0.23.0" ,
3937 "babel-eslint" : " ^8.0.0" ,
You can’t perform that action at this time.
0 commit comments