View exts.cjs
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
console.error('register extension', process.version) | |
const { writeFileSync, readFileSync } = require('fs') | |
const transpile = exports.transpile = file => { | |
const src = readFileSync(file, 'utf8') | |
const tx = `console.log(${JSON.stringify(src)})` | |
writeFileSync(file + '.cjs', tx) | |
} | |
require.extensions['.foo'] = (module, file) => { | |
transpile(file) | |
module.filename = file + '.cjs' |
View t.ts
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 { Test } from '@tapjs/test' | |
import assert from 'node:assert' | |
const t = new Test({}) | |
t.stream.pipe(process.stdout) | |
t.before(() => { | |
assert.equal(t.t, t, 'self ref is equal in before()') | |
}) |
View functional.ts
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
// The idea here is that a plugin is a module that exports a function which | |
// takes a test object as an argument, and returns any kind of object. | |
// utility types | |
type SecondParam< | |
T extends [any] | [any, any], | |
R extends unknown = unknown | |
> = T extends [any, any] ? T[1] : R | |
const copyToString = (v: Function) => ({ |
View lru-benchmark-results.txt
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
> bench-lru@1.2.1 start | |
> NODE_ENV=production node index.js | |
int: just an integer | |
failed prototype pollution check | |
| name | set | get1 | update | get2 | evict | score | | |
|------------------------------------------------------------------|-------|-------|--------|-------|-------|--------| | |
| [just an obj](Object.create(null)) | 25000 | 33333 | 25000 | 33333 | 25000 | 466664 | | |
| [just a {}]({}) | 25000 | 33333 | 25000 | 33333 | 25000 | 466664 | |
View with.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
// look at this glorious shit!! look what you can do with with!! | |
const someObject = { | |
foo: 'bar', | |
baz: 1, | |
asdf: ['quux'], | |
} | |
with (someObject) { | |
console.log(foo) |
View benchmarks.txt
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
--- pattern: './**/0/**/0/**/0/**/0/**/*.txt' --- | |
~~ sync ~~ | |
node fast-glob sync 0m0.523s 10 | |
node globby sync 0m0.514s 10 | |
node current glob.sync mjs 0m0.570s 10 | |
node current glob syncStream 0m0.584s 10 | |
~~ async ~~ | |
node fast-glob async 0m0.280s 10 | |
node globby async 0m0.292s 10 | |
node current glob async mjs 0m0.324s 10 |
View s.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
const apiKey = {{ stripe test private key goes here }} | |
const html = ` | |
<!doctype html> | |
<html> | |
<head> | |
<script type="module"> | |
import { Tier } from 'https://unpkg.com/tier@5.0.3/dist/mjs/client.js' | |
const tier = new Tier({ | |
apiKey: ${JSON.stringify(apiKey)}, | |
baseURL: 'https://api.tier.run', |
View getSet.patch
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
diff --git a/index.js b/index.js | |
index fa53c12..620cf57 100644 | |
--- a/index.js | |
+++ b/index.js | |
@@ -849,6 +849,114 @@ class LRUCache { | |
} | |
} | |
+ getSet( | |
+ k, |
View npm-package.npm
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
{"name":"hello-world-bespoke-archive-format","version":"1.0.0","main":"lib/index.js"} | |
console.log('hello, world!') | |
# hello-world-bespoke-archive-format | |
An example of a "hello world" program, but instead of being a tarball, it's | |
shown in the bespoke package format that npm *SHOULD* have used, instead of | |
tar. | |
One can be forgiven for not wanting to reinvent the wheel, but let this be a | |
lesson that, in fact, some wheels _ought_ to be reinvented, when the |
View awwwwwyiss.txt
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
$ rm -rf .tap; _TAPJS_PROCESSINFO_EXCLUDE_='/(?!'$PWD'/lib/node-options-to-argv.cjs$)^.*$/' node --loader=./lib/esm.mjs test/node-options-to-argv.cjs | |
(node:41096) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time | |
(Use `node --trace-warnings ...` to show where the warning was created) | |
TAP version 13 | |
1..7 | |
ok 1 - should be equivalent | |
ok 2 - should be equivalent | |
ok 3 - should be equivalent | |
ok 4 - should be equivalent | |
ok 5 - should be equivalent |
NewerOlder