Skip to content

Instantly share code, notes, and snippets.

View nikita-rudenko's full-sized avatar
⚛️

Nikita Rudenko nikita-rudenko

⚛️
View GitHub Profile
/**
* Gets all values from object regardless of their level of nesting
*/
export const getAllObjectValues = <T>(obj: { [key: string]: any }): T[] => {
const values = [];
for (let i = 0; i < Object.values(obj).length; i += 1) {
const element = Object.values(obj)[i];
if (typeof element === "object" && element !== null) {
values.push(...getAllObjectValues(element));
@nikita-rudenko
nikita-rudenko / Counter.class.tsx
Created December 25, 2020 23:57
Class-based and hooks-based React components comparison
import { Component } from "react"
type State = {
count: number
}
type Props = {
initialCount: number
}
@nikita-rudenko
nikita-rudenko / .eslintrc
Last active March 31, 2021 14:38
Developer Experience setup
{
"extends": [
"react-app",
"react-app/jest",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
"rules": {
const cuisinesTemplate = {
american: [],
italian: [],
french: []
}
function serveBuffet(dishes) {
const buffet = dishes.reduce((acc, dish) => {
const cuisine = dish.cuisine.toLowerCase();
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.