Optional - Set format on save and any global prettier options
npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
-- phpMyAdmin SQL Dump | |
-- version 4.8.5 | |
-- https://www.phpmyadmin.net/ | |
-- | |
-- Host: localhost:8889 | |
-- Generation Time: May 20, 2019 at 06:28 PM | |
-- Server version: 5.7.25 | |
-- PHP Version: 7.3.1 | |
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; |
import Maybe from 'crocks/Maybe' | |
import Star from 'crocks/Star' | |
import prop from 'crocks/Maybe/prop' | |
import propOr from 'crocks/helpers/propOr' | |
import resultToMaybe from 'crocks/Maybe/resultToMaybe' | |
import tryCatch from 'crocks/Result/tryCatch' | |
const MaybeStar = | |
Star(Maybe) |
/** | |
* searches deep into an object recursively... | |
* @param {Object} obj object to be searched | |
* @param {any} searchValue the value/key to search for | |
* @param {Object} [options] | |
* @param {boolean} options.[searchKeys] whether to search object keys as well as values. Defaults to `true` if `serchValue` is a string, `false` otherwise. | |
* @param {number} options.[maxDepth=20] maximum recursion depth (to avoid "Maximum call stack size exceeded") | |
* @returns {string[]} Paths on the object to the matching results | |
*/ | |
const findPaths = ( |
const { | |
between, | |
many, | |
choice, | |
sequenceOf, | |
char, | |
whitespace, | |
anythingExcept, | |
possibly, | |
regex, |
When building components, we mostly start out with a minimal API, as we mostly have a clear initial idea of what the Component should do. But as requirements start to change, our API might start to evolve a long the way too. We start adding more props to cover conditional or special cases etc. Sometimes we use optional props, as in not required, or we might start using flags, as in boolean props or enums, to handle variants. Let's take a closer look at optional props and what effects these can have on our UI representation.
// Give Node access to path | |
const path = require('path') | |
const fs = require('fs') | |
// Setup parser for taking apart the HTML Description hack stuff from Shopify | |
const DomParser = require('dom-parser') | |
const shopifyDescParser = new DomParser() | |
exports.createPages = async ({ graphql, actions }) => { | |
const { createPage } = actions |
// Consider a type consisting of either no values or two values (of distinct types) | |
// :: type TwoOrNone a b = | |
// :: { label: 'nil', values: () } | |
// :: | { label: 'cons', values: (a, b) } | |
// For convenience, we can write some constructors for values of this type, | |
// and a "destructor" to help us tell the different cases apart | |
// :: TwoOrNone a b |
/** | |
* This method sequences an array of Monads, chaining each one into the next. | |
* The result will be one Monad of a list of each unwrapped value. | |
*/ | |
function sequenceM(Type) { | |
return ms => { | |
function doIt(mArr, restMs) { | |
if(restMs.length === 0) { | |
return mArr; | |
} else { |