@postinumero/map-get-with-default

import get from '@postinumero/map-get-with-default';

Usage no npm install needed!

<script type="module">
  import postinumeroMapGetWithDefault from 'https://cdn.skypack.dev/@postinumero/map-get-with-default';
</script>

README

@postinumero/map-get-with-default

Example

import get from '@postinumero/map-get-with-default';

const map = new Map();

// Using the proposed bind operator (::) (https://github.com/tc39/proposal-bind-operator)
console.log(map::get('x', () => 'foo')); // => 'foo'

console.log(get(map, 'x', () => 'foo2')); // => 'foo'

console.log(map.get('x')); // => 'foo'