Skip to content

Instantly share code, notes, and snippets.

@TylorS
Last active January 24, 2017 03:22
Show Gist options
  • Save TylorS/ab01ec66d8e21df201802cd3d3f915a6 to your computer and use it in GitHub Desktop.
Save TylorS/ab01ec66d8e21df201802cd3d3f915a6 to your computer and use it in GitHub Desktop.
esnextbin sketch
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- put additional styles and scripts here -->
</head>
<body>
<!-- put markup and other contents here -->
</body>
</html>
import { fromObject, set, get } from '@typed/hashmap';
console.clear();
const initial = fromObject({
a: 1,
b: 2,
// h: 8,
// i: 9,
// j: 10,
// k: 11,
// l: 12,
// m: 13,
// n: 14,
// o: 15,
// p: 16,
// q: 17,
// r: 18,
// s: 19,
// t: 20,
// u: 21,
// v: 22,
// w: 23,
// x: 24,
// y: 25,
// z: 26
})
console.log(get('a', initial))
console.log(get('p', initial))
console.log(initial)
const newMap = set('a', 10, initial);
console.log(get('a', newMap))
console.log(get('a', initial))
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"@typed/hashmap": "0.1.0"
}
}
'use strict';
var _hashmap = require('@typed/hashmap');
console.clear();
var initial = (0, _hashmap.fromObject)({
a: 1,
b: 2
});
// h: 8,
// i: 9,
// j: 10,
// k: 11,
// l: 12,
// m: 13,
// n: 14,
// o: 15,
// p: 16,
// q: 17,
// r: 18,
// s: 19,
// t: 20,
// u: 21,
// v: 22,
// w: 23,
// x: 24,
// y: 25,
// z: 26
console.log((0, _hashmap.get)('a', initial));
console.log((0, _hashmap.get)('p', initial));
console.log(initial);
var newMap = (0, _hashmap.set)('a', 10, initial);
console.log((0, _hashmap.get)('a', newMap));
console.log((0, _hashmap.get)('a', initial));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment