Skip to content

Instantly share code, notes, and snippets.

Avatar
🐍

devsnek devsnek

🐍
View GitHub Profile
View ohno.diff
diff --git a/src/abstract-ops/object-operations.mjs b/src/abstract-ops/object-operations.mjs
index fa5b789..ee740d2 100644
--- a/src/abstract-ops/object-operations.mjs
+++ b/src/abstract-ops/object-operations.mjs
@@ -320,6 +320,13 @@ export function OrdinaryHasInstance(C, O) {
if (Type(O) !== 'Object') {
return Value.false;
}
+ if ('Objects' in O) {
+ for (const SubO of O.Objects) {
View slice_notation.diff
diff --git a/src/intrinsics/ArrayPrototype.mjs b/src/intrinsics/ArrayPrototype.mjs
index f6be4d6..c0f658f 100644
--- a/src/intrinsics/ArrayPrototype.mjs
+++ b/src/intrinsics/ArrayPrototype.mjs
@@ -563,6 +563,7 @@ export function BootstrapArrayPrototype(realmRec) {
);
proto.DefineOwnProperty(wellKnownSymbols.iterator, proto.GetOwnProperty(new Value('values')));
+ proto.DefineOwnProperty(wellKnownSymbols.slice, proto.GetOwnProperty(new Value('slice')));
View abort_async_function.diff
diff --git a/src/completion.mjs b/src/completion.mjs
index 96a909a..e56da42 100644
--- a/src/completion.mjs
+++ b/src/completion.mjs
@@ -5,6 +5,8 @@ import {
PerformPromiseThen,
PromiseResolve,
SetFunctionLength,
+ ToBoolean,
+ Get,
View WiTeX.css
/*********************************************************************
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
For more information, please refer to <http://unlicense.org/>
*********************************************************************/
View repl.js
'use strict';
const { createInterface, clearScreenDown } = require('readline');
const { EventEmitter } = require('events');
const { spawn } = require('child_process');
const WebSocket = require('ws');
const acorn = require('acorn-loose');
const { isIdentifier, strEscape } = require('./src/util');
const highlight = require('./src/highlight');
View repl.js
'use strict';
const { EventEmitter } = require('events');
const { spawn } = require('child_process');
const WebSocket = require('ws');
class Session extends EventEmitter {
constructor(url) {
super();
View CMakeLists.txt
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
if (POLICY CMP0075)
cmake_policy(SET CMP0075 NEW)
endif ()
# The following must be set BEFORE doing project() or enable_language().
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type defined; defaulting to 'Debug'")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
View find_longest.js
const path = require('path');
let longestLine = '';
const queue = ['./src'];
while (queue.length) {
const dir = queue.shift();
const files = fs.readdirSync(dir, { withFileTypes: true });
files.forEach((f) => {
const name = path.join(dir, f.name);
View x.js
new Promise((resolve, reject) => {
const timeout = setTimeout(() => {
clearInterval(interval);
reject(new Error('timed out'));
}, 5000);
const interval = setInterval(() => {
const x = doSomething();
if (x !== undefined) {
clearInterval(interval);
clearTimeout(timeout);
View WeakValueMap.mjs
const KEYS = 1;
const VALUES = 2;
const KEYS_VALUES = 3;
export default class WeakValueMap {
#map = new Map();
#group = new FinalizationGroup((iterator) => {
for (const key of iterator) {
this.#map.delete(key);
}
You can’t perform that action at this time.