Skip to content

Commit 2213be6

Browse files
author
Cyril Mizzi
committed
Revert "fixes style code"
This reverts commit 89109a8.
1 parent 706b3c1 commit 2213be6

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

__tests__/purgecssDefault.test.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -357,22 +357,23 @@ describe('purge methods with raw content and default extractor with whitelisted
357357
.double-class {color: black;}`
358358
}
359359
],
360-
whitelistPatterns: [
360+
whitelistPatterns : [
361361
{
362-
pattern: /^double-class$/,
363-
keepChildren: true
364-
}
362+
pattern : /^double-class$/,
363+
keepChildren : true
364+
},
365365
]
366366
}).purge()[0].css
367367
})
368368

369-
it('keeps double-class children', () => {
369+
it ('keeps double-class children', () => {
370370
expect(purgecssResult.includes('.double-class test')).toBe(true)
371371
expect(purgecssResult.includes('.double-class.red')).toBe(true)
372372
expect(purgecssResult.includes('.double-class > .first-class')).toBe(true)
373373
})
374374

375-
it('removes double-class--black class because of $', () => {
375+
it ('removes double-class--black class because of $', () => {
376376
expect(purgecssResult.includes('.double-class--black')).toBe(false)
377377
})
378378
})
379+

src/index.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -446,24 +446,24 @@ class Purgecss {
446446
getWhitelistedSelector(selector: string): Object {
447447
if (this.options.whitelist) {
448448
for (const item of this.options.whitelist) {
449-
const isString = typeof item === 'string'
450-
const pattern = isString ? item : item.pattern
449+
const isString = (typeof item === 'string')
450+
const pattern = (isString) ? item : item.pattern
451451

452452
// Assert the pattern match the given selector
453453
if (pattern === selector) {
454-
return isString ? { pattern: pattern } : item
454+
return (isString) ? { pattern : pattern } : item
455455
}
456456
}
457457
}
458458

459459
if (this.options.whitelistPatterns) {
460460
for (const item of this.options.whitelistPatterns) {
461-
const isRegExp = item instanceof RegExp
462-
const pattern = isRegExp ? item : item.pattern
461+
const isRegExp = (item instanceof RegExp)
462+
const pattern = (isRegExp) ? item : item.pattern
463463

464464
// Assert the pattern match the given selector
465465
if (pattern.test(selector)) {
466-
return isRegExp ? { pattern: pattern } : item
466+
return (isRegExp) ? { pattern : pattern } : item
467467
}
468468
}
469469
}
@@ -478,7 +478,7 @@ class Purgecss {
478478
*/
479479
hasSelectorKeepChildren(selector: string): Object {
480480
const whitelist = this.getWhitelistedSelector(selector)
481-
return whitelist.hasOwnProperty('keepChildren') ? whitelist.keepChildren : false
481+
return (whitelist.hasOwnProperty('keepChildren')) ? whitelist.keepChildren : false
482482
}
483483
}
484484

0 commit comments

Comments
 (0)