Skip to content

Instantly share code, notes, and snippets.

View hanh090's full-sized avatar

Hanh Le hanh090

  • Ho Chi Minh City
View GitHub Profile
@hanh090
hanh090 / memoize1.js
Last active March 18, 2020 02:26
Correct way to using memoize in EH project
// Import memoize from lodash fp package - it is convention in EH project
import memoize from 'lodash/fp/memoize';
// in lodash functional programming, memoize only have 1 argument
// this is code to changed to original API which support keyResolver
const memoizeWithResolver = memoize.convert({ fixed: false });
const keyResolver = (...args) => JSON.stringify(args);// Just sample code, you can choose method which you prefer
const withMemo = memoizeWithResolver((a,b) => doSomethingWith(a,b), keyResolver)
{
"items": [
{
"id": 37,
"description": "test owner",
"full_description": "gdsgsd",
"status": "pending",
"due_date": 1587427200000,
"completed_at": null,
"assignee": {
// Request: http://localhost:3000/api/v2/organisations/1/onboarding_checklists/2
{
"all_required": true,
"assignee_ids": [],
"boarding_tasks": [
{
"full_description": null,
"due_date": 0,
"assign_to": [],
"assignee_ids": [
[
{
"id": "1ddf64b0-6191-482e-b466-21f593560001",
"date": "2021-05-17T10:37:11",
"slug": "eiusmod-adipisicing-officia-do-pariatur-eu",
"title": "Ea reprehenderit non occaecat qui eiusmod Lorem ex anim enim deserunt incididunt exercitation nulla.",
"picture": {
"thumbnail": "https://images.unsplash.com/photo-1626131719997-e216ff236c40?fit=crop&q=80&w=800&h=600",
"medium": "https://images.unsplash.com/photo-1626131719997-e216ff236c40?fit=crop&q=80&w=1280&h=720",
"large": "https://images.unsplash.com/photo-1626131719997-e216ff236c40?fit=crop&q=80&w=1920&h=1080"