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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@scalable.software/graph.structure

v2.1.3

Published

Nodes and Connections Data Structures with Utility Functions

Downloads

1

Readme

License: CC BY-NC-SA 4.0

Graph Structure

This is a ES6 modules that can be used to create a graph structure. The graph structure is a data structure that consists: metadata, nodes and connections.

Installation

  1. Create a new repository using this template

  2. Clone the repository to your local machine

  3. Install the dependencies

npm install
  1. Run the unit tests to ensure everything is working as expected
npm test
  1. Build the web component
npm run build

Note: this module was build using the web.component templates. Follow the link to get more information about the unique features of the architecture in use.

Usage

A simple demo is provided in the demo folder. To run the demo run the following command:

npm run serve

Open the console and you will see a sample node printed to the console.

API

Extended arrays as used for the graph nodes and connections. The methods available on graph.nodes and graph.connections includes a fluent API, where possible. The following methods are available:

Nodes

  • graph.nodes.create(details: Omit<Node, 'id'>): Nodes Create a new node by using the provided details, adding a unique id and adding it to graph.nodes

  • graph.nodes.add(node: Node | Node[]): Nodes Add a node to the graph

  • graph.nodes.addMetadata(id: UUID, metadata: NodeMetadata): Nodes Add metadata to a node in graph.nodes where id matches the provided id

  • graph.nodes.update(id: UUID, update: Node): Nodes Update a node in graph.nodes where id matches the provided id

  • graph.nodes.updateMetadata(id: UUID, metadata: NodeMetadata): Nodes Update the metadata of a node in graph.nodes where id matches the provided id

  • graph.nodes.updateIcon(id: UUID, icon: string): Nodes Update the icon of a node in graph.nodes where id matches the provided id

  • graph.nodes.updateCoordinates(id: UUID, coordinates: Coordinates): Nodes Update the coordinates of a node in graph.nodes where id matches the provided id

  • graph.nodes.findById(id: UUID): Node Find a node in graph.nodes where id matches the provided id

  • graph.nodes.findByType(type: NodeType): Node[] Find all nodes in graph.nodes where type matches the provided type

  • graph.nodes.findByCoordinates(coordinates: Coordinates): Node[] Find all nodes in graph.nodes where coordinates matches the provided coordinates

  • graph.nodes.translate(id: UUID, offset: Offset): Nodes Translate a node in graph.nodes where id matches the provided id by the provided offset

  • graph.nodes.removeMetadata(id: UUID, type: NodeType): Nodes Remove metadata from a node in graph.nodes where id matches the provided id and key matches the provided key

  • graph.nodes.remove(id: UUID): Nodes Remove a node from graph.nodes where id matches the provided id

Connections

  • graph.connections.create(details: Omit<Connection, 'id'>): Connections Create a new connection by using the provided details, adding a unique id and adding it to graph.connections

  • graph.connections.add(connection: Connection | Connection[]): Connections Add a connection to the graph.connections

  • graph.connections.update(id: UUID, update: Connection): Connections Update a connection in graph.connections where id matches the provided id

  • graph.connections.findById(id: UUID): Connection Find a connection in graph.connections where id matches the provided id

  • graph.connections.translate(id: UUID, offset: Offset): Connections Translate a connection in graph.connections where id matches the provided id by the provided offset

  • graph.connections.remove(id: UUID): Connections Remove a connection from graph.connections where id matches the provided id

For more details see the documentation available at is available in the docs folder after running the following command:

npm run document

License

his software and its documentation are released under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License (CC BY-NC-SA 4.0). This means you are free to share, copy, distribute, and transmit the work, and to adapt it, but only under the following conditions:

Attribution: You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).

NonCommercial: You may not use this material for commercial purposes.

ShareAlike: If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.

For more details, please visit the full license agreement.