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

@kingjs/poset.inherit

v1.0.11

Published

Inherits properties of dependent vertices.

Readme

@kingjs/poset.inherit

Inherits properties of dependent vertices.

Usage

Create descriptors of the tire counts of car, truck, and bigRig by inheriting common properties from vehicle like this:

var inherit = require('@kingjs/poset.inherit');
var decode = require('@kingjs/poset.decode');

var decodeAndInherit = function(encodedPoset) {
  var vertices = { };
  var poset = decode.call(encodedPoset, vertices);
  return inherit.call(poset, vertices);
}

var vehicleDescriptors = {
  car$vehicle: { },
  truck$vehicle: { },
  bigRig$vehicle: { tires: 18 },
  vehicle: { tires: 4 }
};

decodeAndInherit(vehicleDescriptors);

result:

{
  car: { tires: 4 },
  truck: { tires: 4 },
  bigRig: { tires: 18 },
  vehicle: { tires: 4 }
}

Given a poset composed of vertex

  • 'A' with property 'a' that depends on
  • 'B' and 'C' with properties 'b' and 'c' respectively and which both depend on
  • 'D' with property 'd'.

Assume all properties have value 0. Now,

  • have 'B' and 'C' inherit 'D''s properties and
  • 'A' inherit 'B' and 'C''s properties
    • as well as 'D''s properties transitively,

like this:

var inherit = require('@kingjs/poset.inherit');
var decode = require('@kingjs/poset.decode');

var decodeAndInherit = function(encodedPoset) {
  var vertices = { };
  var poset = decode.call(encodedPoset, vertices);
  return inherit.call(poset, vertices);
}

//     A={a:0}             A={a:0,b:0,c:0,d:0}
//     /     \                   /     \
// B={b:0}  C={c:0}  ->  B={b:0,d:0}  C={c:0,d:0}
//     \     /                   \     /
//     D={d:0}                   D={d:0}
decodeAndInherit({
  A$B$C: { a:0 },
  B$D: { b:0 },
  C$D: { c:0 },
  D: { d:0 },
});

result:

{
  A: { a:0, b:0, c:0, d:0 },
  B: { b:0, d:0 },
  C: { c:0, d:0 },
  D: { d:0 }
}

API

declare function(
  this: AdjacencyList,
  vertices: VertexProperties
): any

Interfaces

Parameters

  • this: A descriptor whose every property represents a vertex and whose value is an array of strings representing the vertex's adjacent vertices.
  • vertices: A descriptor whose every property represents a vertex and whose value represents the properties associated with the vertex.

Returns

A descriptor with a property for each vertex whose value is a descriptor which inherits the properties of its dependent vertices.

Remarks

Throws if inherited properties that share the same name do not also have the same value.

Install

With npm installed, run

$ npm install @kingjs/poset.inherit

License

MIT

Analytics