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

xresourcemanager

v1.1.0

Published

X resource manager

Downloads

2

Readme

This program provides implementation of X resource manager in JavaScript.
For example it can be used with the Node.js X11 client library, but it can
even be used standalone without any connection to any X server. Program is
written purely in JavaScript and does not use any I/O, DOM, FFI, etc, with
the exception that it does set module.exports to the XRM function.

In this program, a "quark" means either a string or a symbol. The quark
"?" is special. A resource access consists of two lists of quarks, one for
names and one for classes.

XRM function (the exported value of this module) can be called as a
constructor to create a new empty resource database. Can have an optional
argument to set the value of the root node. Each node is also a XRM object
with the same properties methods; the nodes are automatically created.

The instance then has the properties/methods:

.enumerate()
  A generator function; yields the key/value pairs for each key/value pair
  in the database. These pairs are returned as arrays of two elements,
  where the first is the binding/quark list and the second is the value.
  (Not the same as XrmEnumerateDatabase().)

.get(names,[classes])
  Get value of resource, given a list of names and of classes; the list of
  classes may be omitted.

.load(text,[override])
  Load resources from the text, in the X resource manager file format, but
  #include is not supported. If override is true or omitted then it will
  overwrite conflicting entries; if false then existing entries will have
  priority over new ones.

.loose
  A object with no prototype. The keys of this object are the quarks for
  loose bindings at this level.

.merge(db,[override])
  Merge the given database into this one. Can specify whether or not to
  override existing entries; by default it is true.

.put(key,value,[override])
  Put a value to the database. The key is the binding/quark list, which
  is an array of alternating bindings and quarks where bindings can be "."
  or "*" and the quarks can be any string or symbol. Value can be any
  JavaScript value. If undefined or omitted, deletes it (the node itself
  continues to exist though). If override is true or omitted then it will
  write even if the entry already exists, but if false then it will write
  only if the entry is not already exist.

.save()
  Returns a string representation of the database. Won't work if it
  contains any unique quarks or non-string values.

.search(names,classes)
  A generator function that yields resource database node objects. The
  names and classes are two arrays of the same length, containing the list
  of the quarks in the path to search for. The objects it yields are the
  nodes where a match is possible, in order of best priority to worse
  priority. May even yield nodes that lack a value.

.tight
  Similar to loose but for tight bindings.

.value
  The value of this node, or undefined if it has no value.

Static properties of the XRM constructor itself include:

.load(text)
  Load a new database from a string; #include is not supported.

.loadFile(filename)
  Load a new database from a file; #include is supported.

See also:
 https://www.x.org/releases/current/doc/libX11/libX11/libX11.html#Resource_Manager_Functions