1
1
var fs = require ( 'fs' )
2
2
, path = require ( 'path' )
3
- , XmlEntities = require ( 'html-entities' ) . XmlEntities
3
+ , { XmlEntities } = require ( 'html-entities' )
4
4
, util = require ( './util' )
5
5
, extractorPath = path . join ( __dirname , 'extractors' )
6
6
, entities = new XmlEntities ( )
@@ -11,8 +11,8 @@ var fs = require( 'fs' )
11
11
, satisfiedExtractors = 0
12
12
, hasInitialized = false
13
13
, STRIP_ONLY_SINGLE_LINEBREAKS = / ( ^ | [ ^ \n ] ) \n (? ! \n ) / g
14
- , WHITELIST_PRESERVE_LINEBREAKS = / [ ^ A - Z a - z \x80 - \xFF \x24 \u20AC \xA3 \xA5 0 - 9 \u2015 \u2116 \u2018 \u2019 \u201C | \u201D \u2026 \uFF0C \u2013 \u2014 \u00C0 - \u1FFF \u2C00 - \uD7FF \uFB50 – \uFDFF \uFE70 – \uFEFF \uFF01 - \uFFE6 \. , \? " " ! @ # \$ % \^ & \* \( \) - _ = \+ ; : < > \/ \\ \| \} \{ \[ \] ` ~ ' - \w \n \r ] * / g // eslint-disable-line max-len
15
- , WHITELIST_STRIP_LINEBREAKS = / [ ^ A - Z a - z \x80 - \xFF \x24 \u20AC \xA3 \xA5 0 - 9 \u2015 \u2116 \u2018 \u2019 \u201C | \u201D \u2026 \uFF0C \u2013 \u2014 \u00C0 - \u1FFF \u2C00 - \uD7FF \uFB50 – \uFDFF \uFE70 – \uFEFF \uFF01 - \uFFE6 \. , \? " " ! @ # \$ % \^ & \* \( \) - _ = \+ ; : < > \/ \\ \| \} \{ \[ \] ` ~ ' - \w ] * / g // eslint-disable-line max-len
14
+ , WHITELIST_PRESERVE_LINEBREAKS = / [ ^ A - Z a - z \x80 - \xFF \x24 \u20AC \xA3 \xA5 0 - 9 \u2015 \u2116 \u2018 \u2019 \u201C | \u201D \u2026 \uFF0C \u2013 \u2014 \u00C0 - \u1FFF \u2C00 - \uD7FF \uFB50 – \uFDFF \uFE70 – \uFEFF \uFF01 - \uFFE6 \. , \? ' " " „ « » ! @ # \$ % \^ & \* \( \) - _ = \+ ; : < > \/ \\ \| \} \{ \[ \] ` ~ ' - \w \n \r ] * / g // eslint-disable-line max-len
15
+ , WHITELIST_STRIP_LINEBREAKS = / [ ^ A - Z a - z \x80 - \xFF \x24 \u20AC \xA3 \xA5 0 - 9 \u2015 \u2116 \u2018 \u2019 \u201C | \u201D \u2026 \uFF0C \u2013 \u2014 \u00C0 - \u1FFF \u2C00 - \uD7FF \uFB50 – \uFDFF \uFE70 – \uFEFF \uFF01 - \uFFE6 \. , \? ' " " „ « » ! @ # \$ % \^ & \* \( \) - _ = \+ ; : < > \/ \\ \| \} \{ \[ \] ` ~ ' - \w ] * / g // eslint-disable-line max-len
16
16
;
17
17
18
18
function registerExtractor ( extractor ) {
@@ -21,10 +21,8 @@ function registerExtractor( extractor ) {
21
21
if ( typeof type === 'string' ) {
22
22
type = type . toLowerCase ( ) ;
23
23
typeExtractors [ type ] = extractor . extract ;
24
- } else {
25
- if ( type instanceof RegExp ) {
26
- regexExtractors . push ( { reg : type , extractor : extractor . extract } ) ;
27
- }
24
+ } else if ( type instanceof RegExp ) {
25
+ regexExtractors . push ( { reg : type , extractor : extractor . extract } ) ;
28
26
}
29
27
} ) ;
30
28
}
@@ -107,8 +105,7 @@ function findExtractor( type ) {
107
105
var i
108
106
, iLen = regexExtractors . length
109
107
, extractor
110
- , regexExtractor
111
- ;
108
+ , regexExtractor ;
112
109
113
110
type = type . toLowerCase ( ) ;
114
111
if ( typeExtractors [ type ] ) {
@@ -144,8 +141,8 @@ function extract( type, filePath, options, cb ) {
144
141
145
142
// update error message if type is supported but just not configured/installed properly
146
143
if ( failedExtractorTypes [ type ] ) {
147
- msg += ', extractor for type exists, but failed to initialize.' +
148
- ' Message: ' + failedExtractorTypes [ type ] ;
144
+ msg += ', extractor for type exists, but failed to initialize.'
145
+ + ' Message: ' + failedExtractorTypes [ type ] ;
149
146
}
150
147
151
148
error = new Error ( msg ) ;
0 commit comments