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

frink

v0.5.2

Published

Very liberal implementation of W3C XPath and XQuery functions 3.1

Downloads

30

Readme

Frink: everything but the kitchen sink

Parse XML into a DOM level 4 compatible, persistent (AKA immutable) virtual tree.

Traverse trees with speed-optimized functions reminiscent of XPath.

Parse JSON into similar, traversable trees, or mix with XML.

Generate L3, a lightweight, flat representation of XML or JSON trees (or mixed) for fast storage and retrieval.

Construct trees with a coherent set of functions, to create persistent HTML, XML or JSON documents.

Render persistent trees or L3 as HTML in the browser. Uses a super-simple, lightning-fast tree diffing algorithm.

Validate both XML and JSON using a custom extension of JSON Schema v0.4.

To be used together with Raddle's standards-based document processing language.


Why Frink?

It is not the spoon that bends

The browser's DOM API is ... inconvenient. The stuff you see in a web application is not always represented in the source code. Instead, they are in some part of the browser you need to access or update. So, like others have done before, we'll just connect to those parts and modify our document as though they're already part of it. I didn't come up with this idea: it's called virtual DOM, and there are many libraries out there that work like this.

However, what is called virtual DOM is actually not HTML anymore, as it must obey stricter rules than is just required for the representation you download from the server. It's actually a mix of XML and javascript data (AKA JSON). This library tries to formalize that notion, in a data model called L3N. It also provides tried and tested tools for accessing and updating this data model, as they have been developed in the W3C XML working group. These functional tools have been used for years on semi-structured data with great success. As XML has lost its appeal as data modelling language, I try to salvage the good parts with a modern javascript API, for use in the browser and in nodejs.

Frink integrates with legacy XML projects that don't rely on DTD validation.

API (WIP)

Sequences

Sequences come in two flavors. The default (ArraySeq) is based on a javascript array, the other is an Observable sequence. The two are interopable, to the extend that the array-based Sequence implements a limited number of methods from RxJS and converts to an Observable when needed. To guarantee interoperability, you should use the functions provided by Frink instead of RxJS.

seq(...) => ArraySeq|Observable

Creates a sequence. Any sequences or iterables (except strings) in arguments are flattened. In case any argument is an Observable or a Promise, the sequence is converted to an Observable.

zeroOrOne(seqOrValue) => ArraySeq|Observable

Tests a sequence for cardinality. If it contains zero or one item, the sequence is returned. Else an error is thrown instead.

| Param | Type | Description | | ------ | ------------------- | ------------ | | seqOrValue | ArraySeq|Observable|* | The sequence or value to test |

exactlyOne(seqOrValue) => ArraySeq|Observable

Tests a sequence for cardinality. If it contains exactly one item, the sequence is returned. Else an error is thrown instead.

| Param | Type | Description | | ------ | ------------------- | ------------ | | seqOrValue | ArraySeq|Observable|* | The sequence or value to test |

oneOrMore(seqOrValue) => ArraySeq|Observable

Tests a sequence for cardinality. If it contains one or more items, the sequence is returned. Else an error is thrown instead.

| Param | Type | Description | | ------ | ------------------- | ------------ | | seqOrValue | ArraySeq|Observable|* | The sequence or value to test |

empty(seqOrValue) => Boolean|Observable

Tests is a sequence is entry. Returns a boolean (for ArraySeq or null) or an Observable holding a boolean value if the param is an Observable.

| Param | Type | Description | | ------ | ------------------- | ------------ | | seqOrValue | ArraySeq|Observable|* | The sequence or value to test |

exists(seqOrValue) => Boolean|Observable

The opposite of empty. Returns a boolean for ArraySeq or any other value that isn't a sequence. Returns an Observable holding a boolean value if the param is an Observable.

| Param | Type | Description | | ------ | ------------------- | ------------ | | seqOrValue | ArraySeq|Observable|* | The sequence or value to test |

forEach(seqOrValue, fn)

Apply function to value or each value in sequence.

| Param | Type | Description | | ------ | ------------------- | ------------ | | seqOrValue | ArraySeq|Observable|* | The sequence or value to test | | fn | function | Transformation |

filter(seqOrValue, fn)

Filter value or values in sequence based on provided function.

| Param | Type | Description | | ------ | ------------------- | ------------ | | seqOrValue | ArraySeq|Observable|* | The sequence or value to test | | fn | function | Filter function |

foldLeft(seqOrValue[, seed], fn)

Reduce sequence or value to a new sequence.

| Param | Type | Description | | ------ | ------------------- | ------------ | | seqOrValue | ArraySeq|Observable|* | The sequence or value to test | | fn | function | Transformation |