npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zachvictor/gu-map

v1.2.0

Published

A JavaScript Map wrapper with dot accessor notation and immutability features.

Readme

GuMap

npm version license

A JavaScript Map wrapper with dot accessor notation and immutability features.

Installation

npm install @zachvictor/gu-map

Usage

import { createGuMap } from '@zachvictor/gu-map';

// Basic usage with dot notation
const map = createGuMap([['foo', 1], ['bar', 2]]);
console.log(map.foo);  // 1
map.baz = 3;           // set via dot notation
map.get('baz');        // 3 (standard Map methods work too)

// Iteration works as expected
for (const [key, value] of map) {
  console.log(key, value);
}

// Immutable properties (can add, cannot change)
const immutableProps = createGuMap([['x', 10]], {
  immutableProperties: true,
  throwErrorOnPropertyMutate: true
});
immutableProps.y = 20;  // OK: new property
immutableProps.x = 99;  // Error: cannot change existing property

// Fully immutable map
const frozen = createGuMap([['a', 1]], {
  immutableMap: true,
  throwErrorOnPropertyMutate: true
});
frozen.b = 2;  // Error: map is immutable

API

createGuMap(iterable?, options?)

Creates a new GuMap. Returns a Proxy wrapping a Map instance.

  • iterable — Array or iterable of key-value pairs (same as Map)
  • options — Configuration object (see below)

Returns a proxy that passes instanceof Map checks.

Configuration Options

| Option | Type | Default | Description | |-----------------------------------|---------|---------|--------------------------------------------------------------| | immutableMap | boolean | false | Complete immutability—no add, change, or delete | | immutableProperties | boolean | false | Properties can be added but not changed | | throwErrorOnPropertyMutate | boolean | false | Throw error on mutation attempt (see note below) | | throwErrorOnNonexistentProperty | boolean | false | Throw error when accessing nonexistent property |

Note on throwErrorOnPropertyMutate: When false, mutation attempts are blocked but the behavior depends on JavaScript's strict mode. In ES modules (strict mode), blocked mutations throw TypeError. In non-strict mode, they fail silently.

Supported Map Methods

All standard Map methods work: get(), set(), has(), delete(), entries(), keys(), values(), forEach(), clear(), size, and Symbol.iterator.

Operators

  • Dot notation: map.foo and map.foo = 1
  • in operator: 'foo' in map
  • Spread/iteration: [...map] and for...of
  • delete operator: delete map.foo

Aliases

For backwards compatibility:

  • GuMap is an alias for createGuMap
  • GuMapConfig is an alias for normalizeConfig

Testing

npm test

Uses Node.js built-in test runner with 50 tests covering all configuration options and edge cases.

Why "GuMap"?

The name combines 固 (gù, meaning "solid" or "firm" in Chinese) with Map—a nod to the immutability features. Pronunciation: "goo-map".

License

MIT