View handleError.js
const PrettyError = require('pretty-error')
process.on('unhandledRejection', error => {
const err = new PrettyError()
console.log(err.render(error))
})
// OR
const createCallsiteRecord = require('callsite-record')
View lovable.md

Lovable

Lovable modules maximize developer trust.

To learn how to maximize trust, I studied developers I trust and some of their most popular modules. It's no coincidence that I ended up using some of their modules to build mine!

Dependencies

Dependencies introduce friction. Most of the modules I trust have a small number of dependencies (including siblings). This makes sense. Removing dependencies from your module will remove friction of adoption. I decided that my first lovable module should have zero dependencies.

View speech.js
async function speak(text) {
const msg = new SpeechSynthesisUtterance();
msg.text = text;
// msg.volume = 1; // 0 to 1
// msg.rate = 1; // 0.1 to 10
// msg.pitch = 1; //0 to 2
// msg.lang = this.DEST_LANG;
msg.voice = await new Promise(resolve => {
// Voice are populated, async.
speechSynthesis.onvoiceschanged = (e) => {
View deep-copy.js
function structuredClone(obj) {
const oldState = history.state
history.replaceState(obj, window.title)
const copy = history.state
history.replaceState(oldState, window.title)
return copy
}
View axe-tape-puppeteer.test.js
const test = require('tape')
const util = require('util')
const puppeteer = require('puppeteer')
const component = 'my-component'
let browser, page, focus
const componentId = 'my-component-instance'
const interactionId = 'my-component-trigger'
test(component, async t => {
View index.js
// map with native fn
[' a', 'b ', 'c'].map(Function.prototype.call, String.prototype.trim)
View preact-set-state.js
import { h, Component } from 'preact'
import style from './style'
import state from 'set-state'
const toInteger = n => (isNaN(n) ? 0 : parseInt(n || 0, 10))
// raw count state with default
const count = state(0)
// collects events used to set count
const setCount = state()
// projection of count as integer
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello World Streaming JSON Client</title>
<script src="https://rawgit.com/jimhigson/oboe.js/master/dist/oboe-browser.min.js"></script>
</head>
<body>
View dlv.js
//obj,path,default
function dlv(l,t,o,d){for(d=0,t=t.split?t.split("."):t;l&&d<t.length;)l=l[t[d++]];return void 0===l?o:l}
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites