var FastMap = require('./fast')
var someMap = FastMap()
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
function Obj(x) { | |
if (typeof x !== 'number') throw new Error() | |
Object.defineProperty(this, 'x', {value: x}) | |
} | |
var a = new Obj(1) | |
var b = new Obj(2) | |
// Do `a` and `b` have the same hidden class in v8? | |
// |
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
// Curiosity #1 | |
// ------------ | |
function dart() { | |
this.x = 0; | |
delete this.x; | |
} | |
var A = new dart; |
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
export const READ_ONLY = 1 | |
export const DONT_ENUM = 2 | |
export const DONT_DELETE = 4 | |
export function InstallFunctions(object, attributes, functions) { | |
for (let i = 0; i < functions.length; i += 2) { | |
let field = functions[i] | |
let value = functions[i + 1] | |
AddNamedProperty(object, field, value, attributes) |
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
--- | |
parser: babel-eslint | |
ecmaFeatures: | |
modules: true | |
env: | |
es6: true | |
browser: true | |
node: true |
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
export const actions = { | |
doSomeStuff() { | |
return fetch('/api/stuff').then( | |
(res) => (stores.stuffList = res), | |
(err) => Promise.reject(err) | |
) | |
} | |
} | |
export const stores = { |
Tests are located here:
- https://github.com/ooflorent/makrjs/blob/perf-internal/benchmark/internal-1.js
- https://github.com/ooflorent/makrjs/blob/perf-internal/benchmark/internal-2.js
- https://github.com/ooflorent/makrjs/blob/perf-internal/benchmark/internal-3.js
Execute the following command to run the test suite:
grunt benchmark:internal
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
var Token = { | |
Concatenate: '0', | |
Increment: '1', | |
Decrement: '2', | |
Multiply: '3', | |
Divide: '4', | |
Add: '5', | |
Subtract: '6', | |
Exponent: '7', | |
Modulus: '8', |
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 eventBus = new EventEmitter() | |
function someSystem() { | |
for (const entity of em.query(Timer)) { | |
const {delay} = entity.get(Timer) | |
if (delay <= 0) { | |
// Remove `Timer` component… | |
entity.remove(Timer) | |
// …then dispatch an event | |
eventBus.emit("componentRemoved", {entity}) |
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 ext = (...suffix) => new RegExp(`\\.(?:${ suffix.join('|') })(?:[?#].*)?$`) | |
const loaders = [ | |
// Traditional cases | |
{ test: ext('css'), loaders: ['style', 'css'] }, // single | |
{ test: ext('js', 'jsx', 'es6'), loaders: ['babel'] }, // multiple | |
// Complex case: Font-Awesome adds query strings and/or hashs to files | |
{ test: ext('otf', 'eot', 'svg', 'ttf', 'woff', 'woff2'), loaders: ['file?name=[name].[ext]'] }, | |
] |