Skip to content

Commit

Permalink
feat(ekscss): Use Object.assign rather than spread for better perform…
Browse files Browse the repository at this point in the history
…ance
  • Loading branch information
maxmilton committed Aug 17, 2023
1 parent 76d3f7a commit a7f7da2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/ekscss/src/compiler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable no-restricted-syntax */
/* eslint-disable no-restricted-syntax, prefer-object-spread */

import * as stylis from 'stylis';
import {
Expand Down Expand Up @@ -32,7 +32,9 @@ export function onAfterBuild(callback: BuildHookFn): void {
// TODO: Write tests that prove this doesn't mutate the original object.
// TODO: This is only a shallow clone, should we do a deep clone? Use structuredClone or klona
function mergeDefaultGlobals(globals: Partial<XCSSGlobals>): XCSSGlobals {
const newGlobals = { ...globals, fn: { ...globals.fn } };
const newGlobals = Object.assign({}, globals, {
fn: Object.assign({}, globals.fn),
});
newGlobals.fn.each ??= each;
newGlobals.fn.map ??= _map;
return newGlobals as XCSSGlobals;
Expand Down

0 comments on commit a7f7da2

Please sign in to comment.