Skip to content

Commit

Permalink
Replace Array.at() use to improve browser support (#95)
Browse files Browse the repository at this point in the history
Co-authored-by: Rogin Farrer <rfarrer@wayfair.com>
  • Loading branch information
roginfarrer and Rogin Farrer committed Dec 15, 2022
1 parent 40451b7 commit bf7d842
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/khaki-birds-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'rainbow-sprinkles': patch
---

Replaced Array.at() to improve browser support
3 changes: 2 additions & 1 deletion packages/rainbow-sprinkles/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export function replaceVarsInValue(
scale: CreateStylesOutput['dynamicScale'],
) {
const parsed = propValue.replace(VALUE_REGEX, (match, ...args) => {
const { negated, token }: { negated?: '-'; token?: string } = args.at(-1);
const { negated, token }: { negated?: '-'; token?: string } =
args[args.length - 1];
const v = `${negated ? '-' : ''}${token}`;
if (scale?.[v]) {
return scale[v];
Expand Down

0 comments on commit bf7d842

Please sign in to comment.