@@ -94,7 +94,7 @@ export default class Sanitizer extends Module {
9494 * Array: call sanitize for each item
9595 */
9696 return this . cleanArray ( dataToSanitize , rules ) ;
97- } else if ( typeof dataToSanitize === 'object' ) {
97+ } else if ( _ . isObject ( dataToSanitize ) ) {
9898 /**
9999 * Objects: just clean object deeper.
100100 */
@@ -105,7 +105,7 @@ export default class Sanitizer extends Module {
105105 *
106106 * Clean only strings
107107 */
108- if ( typeof dataToSanitize === 'string' ) {
108+ if ( _ . isString ( dataToSanitize ) ) {
109109 return this . cleanOneItem ( dataToSanitize , rules ) ;
110110 }
111111
@@ -169,7 +169,7 @@ export default class Sanitizer extends Module {
169169 if ( Object . prototype . hasOwnProperty . call ( toolRules , fieldName ) ) {
170170 const rule = toolRules [ fieldName ] ;
171171
172- if ( typeof rule === 'object' ) {
172+ if ( _ . isObject ( rule ) ) {
173173 toolConfig [ fieldName ] = Object . assign ( { } , baseConfig , rule ) ;
174174 } else {
175175 toolConfig [ fieldName ] = rule ;
@@ -195,7 +195,7 @@ export default class Sanitizer extends Module {
195195
196196 let config = { } as SanitizerConfig ;
197197
198- if ( typeof enableInlineTools === 'boolean' && enableInlineTools ) {
198+ if ( _ . isBoolean ( enableInlineTools ) && enableInlineTools ) {
199199 /**
200200 * getting all tools sanitizer rule
201201 */
@@ -292,7 +292,7 @@ export default class Sanitizer extends Module {
292292 * @returns {string }
293293 */
294294 private cleanOneItem ( taintString : string , rule : SanitizerConfig | boolean ) : string {
295- if ( typeof rule === 'object' ) {
295+ if ( _ . isObject ( rule ) ) {
296296 return this . clean ( taintString , rule ) ;
297297 } else if ( rule === false ) {
298298 return this . clean ( taintString , { } as SanitizerConfig ) ;
@@ -309,7 +309,7 @@ export default class Sanitizer extends Module {
309309 * @param {SanitizerConfig } config - config to check
310310 */
311311 private isRule ( config : SanitizerConfig ) : boolean {
312- return typeof config === 'object' || typeof config === 'boolean' || _ . isFunction ( config ) ;
312+ return _ . isObject ( config ) || _ . isBoolean ( config ) || _ . isFunction ( config ) ;
313313 }
314314
315315 /**
0 commit comments