Skip to content

Instantly share code, notes, and snippets.

View kjbrum's full-sized avatar
🤘

Kyle Brumm kjbrum

🤘
View GitHub Profile
@kjbrum
kjbrum / groupBy.js
Created April 13, 2021 21:48
Group an array of object by a specified key
/**
* Group an array of object by a specified key
* @param {array} items Array of objects
* @param {string} key Key to use for grouping
* @returns {object}
*/
const groupBy = (items, key) => {
return items.reduce(
(result, item) => ({
...result,
@kjbrum
kjbrum / base.js
Created May 19, 2022 03:41
Basic styled-system/styled-components setup.
import React, { forwardRef } from 'react'
import styled from 'styled-components'
import css, { get } from '@styled-system/css'
import {
system,
compose,
space,
color,
typography,
layout,