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

@berun/fluent

v7.3.6

Published

Use a chaining API to generate and simplify the modification of front end build and development configurations.

Downloads

164

Readme

@berun/fluent

Use a chaining API to generate and simplify the modification of front end build and development configurations.

_Note: This is just a thin wrapper around webpack-chain with just the core fluent (chainable) maps and sets included, to enable the development of a fluent interface for any such tool, not just webpack.

FluentMap

One of the core API interfaces in @berun/fluent is a FluentMap. A FluentMap operates similar to a JavaScript Map, with some conveniences for chaining and generating configuration. If a property is marked as being a FluentMap, it will have an API and methods as described below:

Unless stated otherwise, these methods will return the FluentMap, allowing you to chain these methods.

// Remove all entries from a Map.
clear()
// Remove a single entry from a Map given its key.
// key: *
delete key
// Fetch the value from a Map located at the corresponding key.
// key: *
// returns: value
get(key)
// Set a value on the Map stored at the `key` location.
// key: *
// value: *
set(key, value)
// Returns `true` or `false` based on whether a Map as has a value set at a particular key.
// key: *
// returns: Boolean
has(key)
// Returns an array of all the values stored in the Map.
// returns: Array
values()
// Returns an object of all the entries in the backing Map
// where the key is the object property, and the value
// corresponding to the key. Will return `undefined` if the backing
// Map is empty.
// This will order properties by their name if the value is
// a FluentMap that used .before() or .after().
// returns: Object, undefined if empty
entries()
// Provide an object which maps its properties and values
// into the backing Map as keys and values.
// You can also provide an array as the second argument
// for property names to omit from being merged.
// obj: Object
// omit: Optional Array
merge(obj, omit)
// Execute a function against the current configuration context
// handler: Function -> FluentMap
// A function which is given a single argument of the FluentMap instance
batch(handler)
// Conditionally execute a function to continue configuration
// condition: Boolean
// whenTruthy: Function -> FluentMap
// invoked when condition is truthy, given a single argument of the FluentMap instance
// whenFalsy: Optional Function -> FluentMap
// invoked when condition is falsy, given a single argument of the FluentMap instance
when(condition, whenTruthy, whenFalsy)

FluentSet

Another of the core API interfaces in BeRun Fluentis a FluentSet. A FluentSet operates similar to a JavaScript Set, with some conveniences for chaining and generating configuration. If a property is marked as being a FluentSet, it will have an API and methods as described below:

Unless stated otherwise, these methods will return the FluentSet, allowing you to chain these methods.

// Add/append a value to the end of a Set.
// value: *
add(value)
// Add a value to the beginning of a Set.
// value: *
prepend(value)
// Remove all values from a Set.
clear()
// Remove a specific value from a Set.
// value: *
delete value
// Returns `true` or `false` based on whether or not the
// backing Set contains the specified value.
// value: *
// returns: Boolean
has(value)
// Returns an array of values contained in the backing Set.
// returns: Array
values()
// Concatenates the given array to the end of the backing Set.
// arr: Array
merge(arr)
// Execute a function against the current configuration context
// handler: Function -> FluentSet
// A function which is given a single argument of the FluentSet instance
batch(handler)
// Conditionally execute a function to continue configuration
// condition: Boolean
// whenTruthy: Function -> FluentSet
// invoked when condition is truthy, given a single argument of the FluentSet instance
// whenFalsy: Optional Function -> FluentSet
// invoked when condition is falsy, given a single argument of the FluentSet instance
when(condition, whenTruthy, whenFalsy)