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

@forsakringskassan/devindex-menu

v2.1.4

Published

Menu for local development

Readme

@forsakringskassan/devindex-menu

Closed Opened

npm install --save-dev @forsakringskassan/devindex-menu

Menu for development mode that can be used with advantage together with fapimock-express.

Usage

The menu can be used in several types of applications. If you're using vue-cli, it can be used as follows:

require("@forsakringskassan/devindex-menu")([
    {
        key: "slow-load",
        title: "Delay",
        reloadOnChange: true,
        execOnChange: "aGlobalMethod",
        options: [
            { title: "Normal loading", value: false },
            { title: "Slow loading", value: true },
        ],
    },
]);

When execOnChange is set to a value, the global function with this name will be called on onChange of the dropdown list.

API

[
    {
        key: String,
        title: String,
        type: String (optional, default, "select")
        description: String (optional),
        reloadOnChange: Boolean (optional, default: true),
        sessionStorage: Boolean (optional, default: false),
        execOnChange: String (optional),
        options: [], Array (see types below)
    },
]

Use mocks directly

It's also possible to use mocks for @forsakringskassan/apimock-express directly. In the types MockMatcher and Mock from apimock-express there is support for metadata that is read by the devindex-menu.

When defining the mock, add meta.title and responses[i].response.label. These correspond to the dropdown label and the name of each option respectively.

 export default defineMock({
+    meta: {
+        title: "GET /dog",
+    },
     responses: [
         createResponseByCookie(
             cookie,
             "border-collie-200",
             {
+                label: "Border collie (200)",
                 body: dogBorderCollie,
             },
         ),
     ],
     defaultResponse: {
+        label: "Default – dachshund (200)",
         status: 200,
         body: dogDachshund,
     },
 );

Inside the application, the mock is then sent directly to devindexMenu.

 import devindexMenu from "@forsakringskassan/devindex-menu";
+import getDogMock from "dog-api/dist/api/private/v1/dog_get.js";

 devindexMenu([
     {
         key: "api-post-leash",
         title: "POST /leash",
         options: [{
             title: "Tracking leash (200)",
             value: "tracking-leash-200"
         }],
     },
+    getDogMock,
 ]);

Type Definitions

select (default)

{ title: String, value: String },

Links

{ title: String, href: String },

Scenario

{
    type: "scenario";
    key: string;
    title: string;
    description?: string;
    cookies: Record<string, string | undefined>;
 },

SessionStorage - Pre-filling

If you specify sessionStorage as true, the value will be saved under key in sessionStorage.

In the example below, you'll get a select with the title Pre-filling. If you make a selection, sessionStorage will get a value fk-dog-model.

import coco from "./tests/mock/prefilled/coco.json";
import fido from "./tests/mock/prefilled/fido.json";

require("@forsakringskassan/devindex-menu")([
    {
        key: "fk-dog-model",
        title: "Pre-filling",
        sessionStorage: true,
        options: [
            { title: "None", value: "" },
            { title: "Coco", value: coco },
            { title: "Fido", value: fido },
        ],
    },
]);

Examples

require("@forsakringskassan/devindex-menu")([
    {
        key: "disable-translate",
        title: "Text",
        options: [
            { title: "Translated text", value: "default" },
            { title: "Show text keys", value: "true" },
        ],
    },
    {
        type: "links",
        title: "Links",
        options: [
            {
                title: "Applicant reviews application for additional cost",
                href: "/#/review/8",
            },
        ],
    },
]);

Development

To compile styling: npm run build