This project is not covered by Drupal’s security advisory policy.

A JavaScript library for parsing menus served by Drupal's menu linkset endpoint. See the decoupled menus documentation for more information about this endpoint.

NOTE: Currently the linkset functionality from the decoupled menus contributed module has been ported to Drupal 10.1. Please check this issue on Drupal.org to know more about the current status.

Requirements

This project has no other node package as a peer dependency.

Installation

Install the package via `npm`:

$ npm i @drupal/decoupled-menu-parser

Usage

import { denormalize } from '@drupal/decoupled-menu-parser';

Denormalize

Denormalizes a set of links into an instance of a Menu.

import { denormalize, MenuInterface, NormalizedMenuInterface } from '@drupal/decoupled-menu-parser';

mainMenu = a_custom_method_that_fetch_data_from_drupal();

// Where mainMenu is the data returned from Drupal.

const menus = denormalize(JSON.parse(mainMenu);

Project information

Releases