This file contains 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
/** | |
* This tiny wrapper file checks for known node flags and appends them | |
* when found, before invoking the "real" _babel-node(1) executable. | |
*/ | |
import getV8Flags from "v8flags"; | |
import path from "path"; | |
getV8Flags(function(err, v8Flags) { | |
if (err != null) throw err; |
This file contains 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
"use strict" | |
// Creates a `generate` function using an alphabet, for optimally small IDs | |
// if you can only use certain characters. This could be useful for file name | |
// generators, minifiers, among many others. You *do* need to expand letter | |
// ranges, though. | |
module.exports = alphabet => { | |
const charTable = [...new Set(Array.from(alphabet, x => `${x}`))] | |
let counter = 0 | |
if (charTable.length < 2) { |
This file contains 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
/** | |
* By Isiah Meadows. | |
* This code is licensed under CC0 1.0 Universal. You can get a copy of the license at https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt | |
*/ | |
if (!function (F) { | |
return {}.__proto__ === Object.prototype; // Also if it's broken | |
}(function () {}) && Object.getPrototypeOf && Object.setPrototypeOf) { | |
Object.defineProperty(Object.prototype, '__proto__', { | |
'get': function () { |
This file contains 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
var hasOwn = {}.hasOwnProperty | |
function writeClasses() { | |
for (var i = 0; i < arguments.length; i++) { | |
var arg = arguments[i] | |
if (!arg) continue | |
if (typeof arg === 'string' || typeof arg === 'number') { | |
this[arg] = true | |
} else if (typeof arg === 'string') { |
This file contains 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
// This is a rough port of their TodoMVC app, using their Hooks API | |
import React, { useRef, useState, useEffect, useMemo } from "react" | |
import { render } from "react-dom" | |
function uuid() { | |
let uuid = "" | |
for (let i = 0; i < 32; i++) { | |
if (i === 8 || i === 12 || i === 16 || i === 20) uuid += "-" |
This file contains 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
// A simpler implementation of date handling, with the following additional | |
// assumptions: | |
// | |
// 1. We only need the day, month, and year. | |
// 2. Time zones are irrelevant. | |
// 3. Day/month/year checks and range checks are *far* more common than date | |
// difference calculation. | |
// 4. Dates are rarely written to, mostly read. | |
// | |
// Helpfully, this lets us represent dates with a single 32-bit integer, which |
This file contains 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
var Module = require("module") | |
function requireUncached(file, baseDir) { | |
// Hack: hijack Node's internal resolution algorithm to require the file | |
// as if from a fake module in the correct base directory. It also will | |
// avoid several bugs with the `resolve` module (Node's is necessarily | |
// more stable). | |
var dirname = path.resolve(baseDir) | |
var m = new Module(path.join(dirname, "dummy.js")) |
This file contains 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 removeNodeFromDOM(vnode) { | |
var parent = vnode.dom.parentNode | |
if (parent != null) { | |
var count = vnode.domSize | |
if (count != null && count > 1) { | |
while (--count) parent.removeChild(vnode.dom.nextSibling) | |
} | |
parent.removeChild(vnode.dom) | |
} | |
} |
This file contains 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 _wmSymbol = Symbol.private("wmSymbol") | |
const _wsSymbol = Symbol.private("wsSymbol") | |
const call = Function.call.bind(Function.call) | |
const hasOwn = Function.call.bind({}.hasOwnProperty) | |
const getOwn = Object.getOwnPropertyDescriptor | |
const TE = TypeError | |
const checkMapThisKey = makeChecker("WeakMap", "weak map", _wmSymbol) | |
const checkSetThisKey = makeChecker("WeakSet", "weak set", _wsSymbol) | |
function makeChecker(name, human, symbol) { |
This file contains 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
// A complete set of type defs for Fantasy Land | |
interface Setoid { | |
"fantasy-land/equals"(other: this): boolean; | |
} | |
interface Ord { | |
"fantasy-land/lte"(other: this): boolean; | |
} | |
interface Semigroupoid<A, B> { |