Skip to content

Instantly share code, notes, and snippets.

🔮
the only way out is through

isaacs isaacs

View GitHub Profile
View c.js
class Foo {
bar = 1
#baz = 0
get bazzer () {
return this.#baz
}
get barrier () {
this.#baz ++
View gist:996d12ad5b3c02772f008fd7232d978a
{ _: [ '/usr/local/bin/node' ],
silent: false,
s: false,
all: false,
a: false,
'exclude-after-remap': true,
excludeAfterRemap: true,
'exclude-node-modules': true,
excludeNodeModules: true,
eager: false,
View gist:1e9a9f29ad232c88402455119fac59bc
diff --git a/lib/writer.js b/lib/writer.js
index 140e449..3f10547 100644
--- a/lib/writer.js
+++ b/lib/writer.js
@@ -147,7 +147,7 @@ Writer.prototype._stat = function (current) {
// if it's a type change, then we need to clobber or error.
// if it's not a type change, then let the impl take care of it.
- if (currentType !== self.type) {
+ if (currentType !== self.type || self.type === 'File' && current.nlink > 1) {
View use-public.js
#!/usr/bin/env node
const pubreg = 'registry.npmjs.org'
const fs = require('fs')
const https = require('https')
const url = require('url')
const packageLock = process.argv[2] || './package-lock.json'
const lock = JSON.parse(fs.readFileSync(packageLock, 'utf8'))
const fix = lock => Promise.all(
View test-args.js
const t = require('tap')
const testFunction = t => {
console.log('extra args', t.options.args)
t.pass('this is fine')
t.end()
}
t.test('abc', { args: ['a', 'b', 'c'] }, testFunction)
t.test('123', { args: [1, 2, 3] }, testFunction)
View bin-wrap.js
var sw = require('spawn-wrap')
var NYC = require('../index.js')
var config = {}
if (process.env.NYC_CONFIG) config = JSON.parse(process.env.NYC_CONFIG)
config.isChildProcess = true
config._processInfo = {
pid: process.pid,
ppid: process.ppid,
View b.js
'use strict'
// test/basic.js
const tap = require('./')
const mam = function (x) {
if (x % 2 === 0) {
return 'even'
} else if (x % 2 === 1) {
return 'odd'
} else if (x > 100) {
return 'big'
View csv-example-for-laurie.js
const fs = require('fs')
const parse = require('csv-parse')
const parserStream = parse({
columns: true,
skip_empty_lines: true
})
fs.createReadStream('file.csv')
.pipe(parserStream)
View lib-types-error.js
const { YAMLMap } = require('yaml/types')
const { parseMap } = require('yaml/util')
class JavaScriptError extends YAMLMap {
toJSON(_, ctx) {
const { name, message, ...rest } = super.toJSON(_, ctx, Object)
const Cls =
name === 'EvalError' ? EvalError
: name === 'RangeError' ? RangeError
: name === 'ReferenceError' ? ReferenceError
View gist:34dde76eb4d74255ab1e288b6999ddaa
diff --git a/bin/wrap.js b/bin/wrap.js
index c15862c..b7d995f 100644
--- a/bin/wrap.js
+++ b/bin/wrap.js
@@ -1,15 +1,13 @@
var sw = require('spawn-wrap')
var NYC = require('../index.js')
-var parentPid = process.env.NYC_PARENT_PID || '0'
-process.env.NYC_PARENT_PID = process.pid
You can’t perform that action at this time.