~80b ponyfill for String.prototype.replaceAll() with good performance.
Why ponyfill? Because this is a proposal for a spec, and polyfilling it in-place before it gets solidified could break code that relies on an incorrect implementation.
~80b ponyfill for String.prototype.replaceAll() with good performance.
Why ponyfill? Because this is a proposal for a spec, and polyfilling it in-place before it gets solidified could break code that relies on an incorrect implementation.
| function serialize(node) { | |
| if (node.nodeType === 3) { | |
| return node.data; | |
| } | |
| else if (node.nodeType === 8) { | |
| return '<!--' + node.data + '-->'; | |
| } | |
| else if (node.nodeType === 1 || node.nodeType === 9) { | |
| let str = '<' + node.nodeName; | |
| const attrs = []; |
| /** | |
| * The Identity Component is a component that does nothing but render its child/children. | |
| */ | |
| export default (props) => props.children; |
| module.exports = require('preact/compat'); |
this isn't a library, don't use this.
it's a 1.5kb react-ey thing but using HTML instead of VDOM. diffing done via a hacked up version of set-dom.
// this is a standard react component, except render() returns an HTML string| 'oncopy oncut onpaste onabort onblur oncancel onchange onclick onclose oncontextmenu ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended onerror onfocus oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart onmousedown onmouseenter onmouseleave onmousemove onmouseout onmouseover onmouseup onmousewheel onpause onprogress onreset onresize onscroll onselect onstalled onsubmit onsuspend ontoggle onwaiting onwheel onpointerdown onpointermove onpointerup onpointercancel onpointerover onpointerout onpointerenter onpointerleave onselectstart onselectionchange onbeforecopy onbeforecut onbeforepaste onsearch onfullscreenchange onfullscreenerror' | |
| .split(' ') | |
| .map(e => { | |
| Element.prototype[e] = null; | |
| }); |
| // import fetch from 'isomorphic-unfetch'; | |
| const RETRIES = 5; | |
| /** | |
| * Example: | |
| * global.fetch = fetchWithRetry; | |
| */ | |
| function fetchWithRetry(url, options) { |
| import Link from 'next/link' | |
| import { withRouter } from 'next/router' | |
| import histore from 'histore' | |
| const historyStore = histore(); | |
| const linkStyle = { | |
| marginRight: 10 | |
| } |
| module.exports = (babel, options = {}) => { | |
| const { types: t } = babel; | |
| return { | |
| name: "optimize-tagged-templates", | |
| visitor: { | |
| TemplateLiteral(path) { | |
| for (let i=0; i<path.node.expressions.length; i++) { | |
| const expr = path.node.expressions[i]; | |
| let isLiteral = t.isStringLiteral(expr); |