Skip to content

Commit 3c39408

Browse files
author
Bart Veneman
committed
further minify output by creating shortcut for Object.assign
1 parent 932774a commit 3c39408

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/index.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ const analyze = (css) => {
418418
const specificitiesC = specificityC.aggregate()
419419
const complexityCount = new CountableCollection(selectorComplexities.toArray()).count()
420420
const totalUniqueSelectors = uniqueSelectors.count()
421+
const assign = Object.assign
421422

422423
return {
423424
stylesheet: {
@@ -428,7 +429,7 @@ const analyze = (css) => {
428429
total: totalComments,
429430
size: commentsSize,
430431
},
431-
embeddedContent: Object.assign(embeddedContent, {
432+
embeddedContent: assign(embeddedContent, {
432433
size: {
433434
total: embedSize,
434435
ratio: css.length === 0 ? 0 : embedSize / css.length,
@@ -446,9 +447,9 @@ const analyze = (css) => {
446447
media: medias.count(),
447448
charset: charsets.count(),
448449
supports: supports.count(),
449-
keyframes: Object.assign(
450+
keyframes: assign(
450451
keyframes.count(), {
451-
prefixed: Object.assign(
452+
prefixed: assign(
452453
prefixedKeyframes.count(), {
453454
ratio: keyframes.size() === 0 ? 0 : prefixedKeyframes.size() / keyframes.size()
454455
}),
@@ -462,11 +463,11 @@ const analyze = (css) => {
462463
total: emptyRules,
463464
ratio: totalRules === 0 ? 0 : emptyRules / totalRules
464465
},
465-
selectors: Object.assign(
466+
selectors: assign(
466467
selectorsPerRule.aggregate(), {
467468
items: selectorsPerRule.toArray(),
468469
}),
469-
declarations: Object.assign(
470+
declarations: assign(
470471
declarationsPerRule.aggregate(), {
471472
items: declarationsPerRule.toArray()
472473
}),
@@ -484,16 +485,16 @@ const analyze = (css) => {
484485
median: [specificitiesA.median, specificitiesB.median, specificitiesC.median],
485486
items: specificities
486487
},
487-
complexity: Object.assign(
488+
complexity: assign(
488489
selectorComplexities.aggregate(),
489490
complexityCount, {
490491
items: selectorComplexities.toArray(),
491492
}),
492-
id: Object.assign(
493+
id: assign(
493494
ids.count(), {
494495
ratio: totalSelectors === 0 ? 0 : ids.size() / totalSelectors,
495496
}),
496-
accessibility: Object.assign(
497+
accessibility: assign(
497498
a11y.count(), {
498499
ratio: totalSelectors === 0 ? 0 : a11y.size() / totalSelectors,
499500
}),
@@ -514,17 +515,17 @@ const analyze = (css) => {
514515
},
515516
},
516517
},
517-
properties: Object.assign(
518+
properties: assign(
518519
properties.count(), {
519-
prefixed: Object.assign(
520+
prefixed: assign(
520521
propertyVendorPrefixes.count(), {
521522
ratio: properties.size() === 0 ? 0 : propertyVendorPrefixes.size() / properties.size(),
522523
}),
523-
custom: Object.assign(
524+
custom: assign(
524525
customProperties.count(), {
525526
ratio: properties.size() === 0 ? 0 : customProperties.size() / properties.size(),
526527
}),
527-
browserhacks: Object.assign(
528+
browserhacks: assign(
528529
propertyHacks.count(), {
529530
ratio: properties.size() === 0 ? 0 : propertyHacks.size() / properties.size(),
530531
}),

0 commit comments

Comments
 (0)