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
| #!/usr/bin/env node | |
| /** | |
| * Depth-first copy with selective transformation. | |
| * For each of the `Iterable` selected by the selector function, it | |
| * applies the `visitor` function and continues recursively. | |
| * | |
| * | |
| * @param {object} node the tree structure | |
| * @param {function} [visitor] the function to apply to selected children |
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
| // https://github.com/jmakeig/iterant/issues/30 | |
| function head(itr) { | |
| if (itr[Symbol.iterator]) return itr[Symbol.iterator]().next().value; | |
| } | |
| function* values(ref, options) { | |
| const sequence = cts.values(ref, options); | |
| for (const value of sequence) { | |
| yield { | |
| value: value.valueOf(), |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Progenitor Mock-up</title> | |
| <style type="text/css"> | |
| table { | |
| position: relative; /* Needed for sticky headers */ | |
| width: 100%; |
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
| //import { Machine, assign } from './xstate.js'; | |
| // Ensure correct dirty checks when Svelte is running in immutable mode. | |
| function clone(object) { | |
| if ('object' === typeof object) { | |
| if (null === object) return object; | |
| if (Array.isArray(object)) return [...object]; | |
| if (object instanceof Set) return new Set(object); | |
| if (object instanceof Map) return new Map(object); | |
| return Object.assign({}, object); |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>Nested Tables</title> | |
| <style> | |
| html { | |
| font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, | |
| Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; | |
| font-size: 14px; |
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
| function clone(...rest) { | |
| return Object.assign({}, ...rest); | |
| } | |
| /** | |
| * Builder for confirmation states. | |
| * | |
| * @param {String} onConfirm State to transition to on confirmation | |
| * @param {String} onCancel State to transition to on cancel | |
| */ |
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 config = { | |
| id: 'annotation', | |
| initial: 'unselected', | |
| context: { | |
| id: null, | |
| annotation: null, | |
| errorMessage: null | |
| }, | |
| states: { | |
| unselected: { |
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
| function fetchAnnotation(id) { | |
| //return Promise.reject('oops!'); | |
| return Promise.resolve({ | |
| id, | |
| comment: 'Dummy resolved', | |
| user: 'jmakeig' | |
| }); | |
| } | |
| function confirmCancel(message = 'You sure?') { |
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
| // Actions are on transitions | |
| // Entry/exit are on states | |
| // Mocks for testing services: https://medium.com/@tahini/how-to-effortlessly-model-async-react-with-xstates-invoke-4c36dc8547b3 | |
| const dirty = { | |
| initial: 'clean', | |
| states: { | |
| clean: { |
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
| { | |
| "exclude": [ | |
| ".git/**", | |
| "node_modules/**", | |
| "bower_components/**" | |
| ], | |
| "always-semicolon": true, | |
| "block-indent": "\t", | |
| "color-case": "lower", | |
| "color-shorthand": true, |