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
// Fetch Standard | |
// prototype pollution | |
Object.prototype.toJSON = () => ({ foo: "foo" }); | |
const response = Response.json({ bar: "bar" }); | |
console.log(await response.json()); |
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
// HTML Standard | |
const { map, arr, obj } = structuredClone((() => { | |
const [map, arr, obj] = [new Map(), [], {}]; | |
map.a = "a"; arr.b = "b"; obj.c = "c"; | |
return { map, arr, obj }; | |
})()); | |
console.log(`${map.a} / ${arr.b} / ${obj.c}`); |
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
import idl from "@webref/idl"; | |
const serializables = []; | |
const transferables = []; | |
const all = await idl.parseAll(); | |
for (const file of Object.values(all)) { | |
for (const obj of file) { | |
if (obj.type !== "interface") { | |
continue; |
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
/** | |
* @file Strict TypedArray Type Check inspired by Node.js util.types implementation | |
* @see https://github.com/nodejs/node/blob/v16.x/lib/internal/util/types.js | |
*/ | |
const TypedArrayPrototype = Object.getPrototypeOf(Uint8Array).prototype; | |
const getTypedArrayPrototypeSybolToStringTag = Object.getOwnPropertyDescriptor(TypedArrayPrototype, Symbol.toStringTag).get; | |
/** | |
* @param {unknown} value |
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
// TypedArray constructor | |
// Array | |
const uint8_1 = new Uint8Array([1, 2, 3]); | |
console.log(uint8_1); | |
// => Uint8Array(3) [1, 2, 3] | |
// ArrayLike | |
const uint8_2 = new Uint8Array({ 0: 1, 1: 2, 2: 3, length: 3 }); | |
console.log(uint8_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
let isSupportedAbortSignalOption = false; | |
try { | |
const options = { | |
get signal() { | |
isSupportedAbortSignalOption = true; | |
return; | |
}, | |
}; | |
(window.addEventListener as any)("test", null, options); |
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
import { useEffect, useState } from "react"; | |
/** | |
* @example | |
* const matches = useMatchMedia("screen and (min-width: 560px)"); | |
* | |
* @param raw | |
*/ | |
export function useMatchMedia(raw: string): boolean { | |
const [matches, setMatches] = useState(false); |
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
import { useEffect, useMemo, useState } from "react"; | |
/** | |
* 後続の Iterator Value と合わせた Iterator を返す | |
* (1, 2, 3) -> ([1, 2], [2, 3], [3, undefined]) | |
* | |
* @param iterable | |
*/ | |
function* withNext<T>(iterable: Iterable<T>): IterableIterator<[T, T | undefined]> { | |
let isStart = true; |
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
http2-casper: ON | |
compress: ON | |
header.setifempty: "X-XSS-Protection: 1; mode=block" | |
header.setifempty: "Expect-CT: max-age=2592000, enforce" | |
header.setifempty: "Expect-Staple: max-age=31536000; includeSubDomains; preload" | |
listen: | |
port: 80 |
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 Original = self.EventTarget; | |
let availabilityOfEventTargetConstructor = true; | |
try { | |
new Original(); | |
} catch { | |
availabilityOfEventTargetConstructor = false; | |
} | |
/** @type {{ new(): EventTarget, prototype: EventTarget }} */ |
NewerOlder