New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/ders/menu

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/ders/menu

  • v0.0.0-20170308073400-527b4c69954e
  • Source
  • Go
  • Socket score

Version published
Created
Source

menu

Package menu provides a data structure to represent nested menus such as those that might appear on a web page.

The basic unit is a ListItem, which may be either a List or an Item. An Item consists of a label (e.g. the text that appears, or perhaps a key to a translation table when localized text is needed) and an action (e.g. a url path). A List consists of a label and a list of ListItems.

An Item may optionally have a visibility mask, which may be used when certain parts of the menu need to be dynamically hidden. A example of when this might be useful is an admin submenu which is only visible to authenticated admin users.

The Filtered() method is used to hide parts of a menu based on a bitmask. The provided bitmask is and-ed with the visibility mask of each Item, and the item is shown only if the result is nonzero.

A visibility mask may also be applied to a List. If a List is hidden, all the Lists and Items under it are also hidden.

Menus hay have arbitrary depth, although recursive menus are not supported and will crash.

Menus play well with json.Marshal (see the examples).

GoDoc

FAQs

Package last updated on 08 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc