Skip to content

Instantly share code, notes, and snippets.

Avatar
🔮
only way out is through

isaacs isaacs

🔮
only way out is through
View GitHub Profile
View b.js
const unbound = Symbol('unbound')
const bindMethod = (obj, fn) => {
const value = fn[unbound] || fn
return Object.assign(value.bind(obj), { [unbound]: value })
}
const bindObjMethods = obj => {
const proto = Object.getPrototypeOf(obj)
for (const name of Object.getOwnPropertyNames(proto)) {
View gist:5b563f5d43d88980ba90ad12c5986f35
diff --git a/lib/arborist/reify.js b/lib/arborist/reify.js
index 9854d2d..54325aa 100644
--- a/lib/arborist/reify.js
+++ b/lib/arborist/reify.js
@@ -233,12 +233,18 @@ module.exports = cls => class Reifier extends cls {
.then(() => process.emit('timeEnd', 'reify:loadTrees'))
}
+ const updateNames = options.update && options.update.names || []
const actualOpt = this[_global] ? {
View buff-compare.js
const fs = require('fs')
const found = Buffer.concat([
fs.readFileSync(__filename),
Buffer.from('asdf'),
Buffer.from('foo'),
fs.readFileSync(__filename),
])
const wanted = Buffer.concat([
fs.readFileSync(__filename),
Buffer.from('foo'),
View .-ahp.js
const { executionAsyncId, createHook } = require('async_hooks')
const {writeSync} = require('fs')
const {format} = require('util')
const err = (...msg) => writeSync(2, format(...msg) + '\n')
const log = (...msg) => writeSync(1, format(...msg) + '\n')
const hook = createHook({
init (eid, type) {
// err('INIT', eid, type)
View gist:b4dd08150f17e0b564760a2aa47c3b8b
diff --git a/settings.js b/settings.js
index f144fce6..eef39167 100644
--- a/settings.js
+++ b/settings.js
@@ -7,10 +7,13 @@ const StackUtils = require('stack-utils')
let rmdirRecursiveSync
let rmdirRecursive
+let hasFsRm = false
+
View gist:6d719993e41695d63d6d631b318d97e8
diff --git a/lib/format.js b/lib/format.js
index 79cad68..9c7b9eb 100644
--- a/lib/format.js
+++ b/lib/format.js
@@ -125,8 +125,12 @@ class Format {
case 'symbol':
return this.object.toString()
+ case 'bigint':
+ return this.object.toString() + 'n'
View gist:d5263c46586310a68aafa5246c6694f7
diff --git a/lib/format.js b/lib/format.js
index 79cad68..9c7b9eb 100644
--- a/lib/format.js
+++ b/lib/format.js
@@ -125,8 +125,12 @@ class Format {
case 'symbol':
return this.object.toString()
+ case 'bigint':
+ return this.object.toString() + 'n'
View gist:35ec4643b452e361e662897e81ace216
diff --git a/lib/arborist/load-virtual.js b/lib/arborist/load-virtual.js
index f03bd80..6bb07af 100644
--- a/lib/arborist/load-virtual.js
+++ b/lib/arborist/load-virtual.js
@@ -24,6 +24,7 @@ const loadWorkspacesVirtual = Symbol.for('loadWorkspacesVirtual')
const flagsSuspect = Symbol.for('flagsSuspect')
const reCalcDepFlags = Symbol('reCalcDepFlags')
const checkRootEdges = Symbol('checkRootEdges')
+const rootOptionProvided = Symbol('rootOptionProvided')
View gist:0b3a48ef2a3f7a921d2e00482ca0bc9c
commit f762c746c0e13d84db68af5b0d4e711aaa5bee74
Author: Romain Marcadier <romain.muller@telecomnancy.net>
Date: Mon Feb 8 11:28:53 2021 +0100
fix: TypeError when loading graceful-fs from worker threads
Fixes #204
PR-URL: https://github.com/isaacs/node-graceful-fs/pull/205
Credit: @RomainMuller
View gist:6704b735c9a504db4819b27dcb8ce685
diff --git a/lib/arborist/load-virtual.js b/lib/arborist/load-virtual.js
index f03bd80..6bb07af 100644
--- a/lib/arborist/load-virtual.js
+++ b/lib/arborist/load-virtual.js
@@ -24,6 +24,7 @@ const loadWorkspacesVirtual = Symbol.for('loadWorkspacesVirtual')
const flagsSuspect = Symbol.for('flagsSuspect')
const reCalcDepFlags = Symbol('reCalcDepFlags')
const checkRootEdges = Symbol('checkRootEdges')
+const rootOptionProvided = Symbol('rootOptionProvided')