This file contains hidden or 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 b from "benny"; | |
| import { | |
| removeSpaces, | |
| removeSpaces2, | |
| removeSpaces3, | |
| removeSpaces4, | |
| } from "./code.js"; | |
| { |
This file contains hidden or 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 NUMBER_OF_FORMULAS = 1000; | |
| const generateName = (num) => { | |
| const charCode = (num % (122 - 96)) + 97; | |
| const count = Math.floor(num / 26); | |
| return String.fromCharCode(charCode).repeat(count + 1); | |
| }; | |
| const formulas = new Map( |
This file contains hidden or 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 b from "benny"; | |
| import calculateWithObject from "./calculate-with-object.js"; | |
| import calculateWithMap from "./calculate-with-map.js"; | |
| b.suite( | |
| "calculate", | |
| b.add("calculate with object", () => { | |
| calculateWithObject("average", 1, 1); | |
| }), |
This file contains hidden or 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 NUMBER_OF_FORMULAS = 1000; | |
| const generateName = (num) => { | |
| const charCode = (num % (122 - 96)) + 97; | |
| const count = Math.floor(num / 26); | |
| return String.fromCharCode(charCode).repeat(count + 1); | |
| }; | |
| const formulas = new Map( |
This file contains hidden or 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 NUMBER_OF_FORMULAS = 1000; | |
| const generateName = (num) => { | |
| const charCode = (num % (122 - 96)) + 97; | |
| const count = Math.floor(num / 26); | |
| return String.fromCharCode(charCode).repeat(count + 1); | |
| }; | |
| const formulas = Object.fromEntries( |
This file contains hidden or 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 US_CONSUMPTION = 3930; | |
| const halvings = [ | |
| new Date("2012.11.28").getTime(), | |
| new Date("2016.07.09").getTime(), | |
| new Date("2020.05.11").getTime(), | |
| ...new Array(30) // 30 more cycles until year 2140 | |
| .fill(0) | |
| .map( | |
| (_, i) => |
This file contains hidden or 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
| run({ | |
| part1: { | |
| tests: [ | |
| { | |
| input: `forward 5 | |
| down 5 | |
| forward 8 | |
| up 3 | |
| down 8 | |
| forward 2`, |
This file contains hidden or 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 Swimmable = () => ({ | |
| speed: 1, | |
| swim() { | |
| console.log(`Swam ${this.speed} meter(s)`) | |
| }, | |
| }) | |
| const Quackable = () => ({ | |
| speed: 1, | |
| quack() { |
This file contains hidden or 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 Swimmable = () => ({ | |
| swim() { | |
| console.log("Swam 1 meter") | |
| }, | |
| }) | |
| const Quackable = () => ({ | |
| quack() { | |
| console.log("Quack!") | |
| }, |
This file contains hidden or 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
| class Swimmable { | |
| constructor() { | |
| this.speed = 1 | |
| } | |
| swim() { | |
| console.log(`Swam ${this.speed} meter(s)`) | |
| } | |
| } |