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

@mnjs/utils

v5.0.0-beta.5

Published

Shared utilities for Marionette components

Readme

@mnjs/utils

The small helpers behind Marionette, available for your own components. Marionette and @mnjs/data import these same implementations.

npm install @mnjs/[email protected]

Use the same version for all Marionette packages. Core and data install utils automatically as a regular dependency. Add it directly when your application imports it.

Building a component

Methods such as getOption, normalizeMethods, and triggerMethod use their receiver as the component. Mix them into a prototype or call them with .call().

import { Events, getOption, normalizeMethods, triggerMethod } from '@mnjs/utils';

const component = {
  ...Events,
  getOption,
  normalizeMethods,
  triggerMethod,
  options: { label: 'Inbox' },
  onOpen() {
    return this.getOption('label');
  }
};

component.triggerMethod('open'); // 'Inbox'
component.normalizeMethods({ open: 'onOpen' });

Events

Events is the shared event implementation used by Marionette, Radio, and native data. Mix it into an object with Object.assign({}, Events) to use on, off, trigger, listenTo, and stopListening without core.

Helpers

Use object spread or Object.assign for ordinary copying and composition. Inherited enumerable parent statics are copied only inside extend.

  • getValue(object, key, fallback) reads a value and calls it on the object if it is a function. getOption reads from this.options, then the receiver.
  • mergeOptions(options, keys) copies selected options onto the receiver.
  • normalizeMethods(map) resolves method names on the receiver. resolveMethod(context, method, name) resolves one handler.
  • bindEvents and unbindEvents use the receiver's listening methods. bindRequests and unbindRequests register or remove channel replies with the receiver as their context. normalizeBindings(context, map) resolves an event map without subscribing.
  • triggerMethod(eventName, ...args) invokes the matching onEventName method and triggers the event.
  • extend is the function-constructor inheritance helper used by Marionette.
  • MarionetteError is the same error constructor exported by Marionette.
  • isString recognizes primitive and boxed strings. setProperty assigns a property, treating __proto__ as an own data property.

ES modules, CommonJS, and TypeScript declarations are included. The package has no runtime dependencies and declares no side effects. Bundlers can retain only the imported helpers. Marionette's standalone UMD bundles include these helpers; module consumers share the installed package.

Event-building helpers buildEventArgs, callHandler, and onceWrap, plus uniqueId, are shared by core and Radio. buildEventArgs preserves each literal string name or own event-map key without splitting whitespace.