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
'use strict'; | |
const { Module } = require('vm'); | |
process.on('unhandledRejection', p => { | |
process.nextTick(() => { throw p; }); | |
}); | |
(async () => { | |
const rootModule = new Module('export default 5;'); |
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
'use strict'; | |
const { Module } = require('vm'); | |
process.on('unhandledRejection', p => { | |
process.nextTick(() => { throw p; }); | |
}); | |
(async () => { | |
const rootModule = new Module('export default 5;'); |
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
"use strict"; | |
// Example integration of the new vm.Module API into jsdom. | |
const vm = require("vm"); | |
const { URL } = require("url"); | |
class ModuleScript { | |
constructor() { | |
this.context = null; |
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
'use strict'; | |
const OriginalArray = global.Array; | |
global.Array = function Array(...args) { | |
const arr = new OriginalArray(...args); | |
let length = arr.length; | |
return new Proxy(arr, { | |
set(target, propKey, value, Receiver) { | |
if (propKey === 'length') { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>64bit comparison</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>for-of loop vs forEach</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
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
extend layout.jade | |
block content | |
p Content |
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": "posthtml-pug", | |
"version": "1.0.0", | |
"description": "PostHTML Pug parser", | |
"main": "index.js", | |
"dependencies": { | |
"constantinople": "^3.1.0", | |
"isobject": "^2.1.0", | |
"object-assign": "^4.1.0", | |
"pug": "^2.0.0-beta5", |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>for-in vs. Object.keys (uncached)</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
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
-20 ~9.53674\times10^-7 ~1.90734\times10^-6 ~1.05879\times10^-22 ~2.11758\times10^-22 | |
-17 ~7.62939\times10^-6 ~1.52587\times10^-5 ~8.47032\times10^-22 ~1.69406\times10^-21 | |
-14 ~6.10351\times10^-5 ~1.22070\times10^-4 ~6.77626\times10^-21 ~1.35525\times10^-20 | |
-11 ~4.88281\times10^-4 ~9.76562\times10^-4 ~5.42101\times10^-20 ~1.08420\times10^-19 | |
-8 ~3.90625\times10^-3 ~7.81249\times10^-3 ~4.33680\times10^-19 ~8.67361\times10^-19 | |
-5 ~3.12500\times10^-2 ~6.24999\times10^-2 ~3.46944\times10^-18 ~6.93889\times10^-18 | |
-2 ~2.50000\times10^-1 ~4.99999\times10^-1 ~2.77555\times10^-17 ~5.55111\times10^-17 | |
1 ~2.00000\times10^0 ~3.99999\times10^0 ~2.22044\times10^-16 ~4.44089\times10^-16 | |
4 ~1.60000\times10^1 ~3.19999\times10^1 ~1.77635\times10^-15 ~3.55271\times10^-15 | |
7 ~1.28000\times10^2 ~2.55999\times10^2 ~1.42108\times10^-14 ~2.84217\times10^-14 |