A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
| let cache = new Map(); | |
| let pending = new Map(); | |
| function fetchTextSync(url) { | |
| if (cache.has(url)) { | |
| return cache.get(url); | |
| } | |
| if (pending.has(url)) { | |
| throw pending.get(url); | |
| } |
A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
| // USAGE: | |
| // | |
| // This script is supposed to be used with `jscodeshift`. Here is how you would invoke it: | |
| // $ jscodeshift -t add-unit-true-to-ember-tests.js --fn=moduleForComponent path/to/unit/tests/ | |
| // | |
| // The `--fn` argument above can be changed to `moduleFor`, `moduleForModel`, etc. | |
| module.exports = function transform(file, api, options) { | |
| var j = api.jscodeshift; | |
| var fn = options.fn || 'moduleForComponent'; |
[based on a true story]
So. Your friend's about to teach you how to make a website. Great!
You make a file, and you save it as 'index.html'. Why it's called 'index' isn't really explained to you, but whatever.
You type the following.
hello world