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
// Simple module system. | |
// \todo [petri] write documentation | |
const mapObject = (obj, mapper) => { | |
const result = {}; | |
for (const key in obj) { | |
let [mkey, value] = mapper(key, obj[key]); | |
result[mkey] = value; | |
} | |
return result; |
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 { createModule } from './simpleModule'; | |
// Standard initialState | |
const initialState = { | |
isAuthenticating: false, | |
userId: null, | |
authError: null | |
}; | |
// These construct action creators as well as the module's reducer. |
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
defmodule Benchmark do | |
def measure(function) do | |
elapsed = function | |
|> :timer.tc | |
|> elem(0) | |
|> Kernel./(1_000_000) | |
IO.puts "Elapsed = #{elapsed}s" | |
end | |
end |