This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const USER_TYPE = { | |
new_customer_hto: "new_customer_hto", | |
new_customer_rx_retail: "new_customer_rx_retail", | |
new_customer_rx: "new_customer_rx", | |
returning_customer_hto: "returning_customer_hto", | |
returning_customer_saved_expired_rx: "returning_customer_saved_expired_rx", | |
returning_customer_saved: "returning_customer_saved", | |
returning_customer_saved_expired_payment: | |
"returning_customer_saved_expired_payment", | |
returning_customer_saved_expired_rx_payment: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async function generateReplies(document) { | |
// https://conventionalcomments.org/#labels | |
const LABEL = { | |
praise: "praise", | |
nitpick: "nitpick", | |
suggestion: "suggestion", | |
issue: "issue", | |
todo: "todo", | |
question: "question", | |
thought: "thought", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reach | |
Register | |
Login | |
processMobileNumber -> Is Returning User? | |
Is Returning User? | |
pass -> Search | |
fail -> Authentication | |
Authentication | |
processToken -> Is Token Valid? | |
Is Token Valid? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const resolveExpression = exp => { | |
const resolved = typeof exp === "function" ? exp() : exp; | |
return Array.isArray(resolved) | |
? resolved.join("") | |
: typeof resolved !== "undefined" ? resolved : ""; | |
}; | |
const html = (strings, ...exps) => { | |
return strings.reduce((acc, str, i) => { | |
return `${acc}${resolveExpression(exps[i - 1])}${str}`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sort or set keys | |
* @param data {object} Keyed data store | |
* @param keysOrSort {array|function} | |
* @return {array} | |
*/ | |
const sortKeys = (data, keysOrSort) => { | |
return typeof keysOrSort === "undefined" | |
? Object.keys(data).sort() | |
: typeof keysOrSort === "function" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Composes functions like c(f, g) === f(g(x)). | |
* @param {arguments} fns Multiple functions w/ map/reduce. | |
* @returns reducer seeded with identity function. | |
* @example compose(x => x + 2, x => x - 1)(5) // 6 (5 + 2 -1) | |
*/ | |
const compose = (...fns) => { | |
return fns.reduce((acc, fn) => { | |
return (...args) => { | |
return acc(fn(...args)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const order = { | |
subtotal: 35, | |
tax: 0.6, | |
get total() { return this.subtotal * this.tax } | |
} | |
order.subtotal // 35 | |
order.tax // 0.6 | |
order.total // 21 | |
order.subtotal = 36 |
NewerOlder