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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@d3plus/dom

v3.0.14

Published

JavaScript functions for manipulating and analyzing DOM elements.

Readme

@d3plus/dom

JavaScript functions for manipulating and analyzing DOM elements.

Installing

If using npm, npm install @d3plus/dom. Otherwise, you can download the latest release from GitHub or load from a CDN.

import modules from "@d3plus/dom";

In vanilla JavaScript, a d3plus global is exported from the pre-bundled version:

<script src="https://cdn.jsdelivr.net/npm/@d3plus/dom"></script>
<script>
  console.log(d3plus);
</script>

Examples

Live examples can be found on d3plus.org, which includes a collection of example visualizations using @d3plus/react.

API Reference

  • assign - A deeply recursive version of Object.assign.
  • attrize - Applies each key/value in an object as an attr.
  • date - Parses numbers and strings to valid Javascript Date objects.
  • elem - Manages the enter/update/exit pattern for a single DOM element.
  • fontExists - Given either a single font-family or a list of fonts, returns the name of the first font that can be rendered, or false if none are installed on the user's machine.
  • isObject - Detects if a variable is a javascript Object.
  • parseSides - Converts a string of directional CSS shorthand values into an object with the values expanded.
  • prefix - Returns the appropriate CSS vendor prefix, given the current browser.
  • rtl - Returns true if the HTML or body element has either the "dir" HTML attribute or the "direction" CSS property set to "rtl".
  • stylize - Applies each key/value in an object as a style.
  • htmlDecode - Strips HTML and "un-escapes" escape characters.
  • textWidth - Given a text string, returns the predicted pixel width of the string when placed into DOM.

d3plus.assign(...objects) <>

A deeply recursive version of Object.assign.

This is a global function this

assign({id: "foo", deep: {group: "A"}}, {id: "bar", deep: {value: 20}}));
    

returns this

{id: "bar", deep: {group: "A", value: 20}}

d3plus.attrize(elem, attrs) <>

Applies each key/value in an object as an attr.

This is a global function


d3plus.date(date) <>

Returns a javascript Date object for a given a Number (representing either a 4-digit year or milliseconds since epoch), a String representing a Quarter (ie. "Q2 1987", mapping to the last day in that quarter), or a String that is in valid dateString format. Besides the 4-digit year parsing, this function is useful when needing to parse negative (BC) years, which the vanilla Date object cannot parse.

This is a global function


d3plus.elem(selector, params) <>

Manages the enter/update/exit pattern for a single DOM element.

This is a global function


d3plus.fontExists(font) <>

Given either a single font-family or a list of fonts, returns the name of the first font that can be rendered, or false if none are installed on the user's machine.

This is a global function


d3plus.isObject(item) <>

Detects if a variable is a javascript Object.

This is a global function


d3plus.parseSides(sides) <>

Converts a string of directional CSS shorthand values into an object with the values expanded.

This is a global function


d3plus.prefix() <>

Returns the appropriate CSS vendor prefix, given the current browser.

This is a global function


d3plus.rtl() <>

Returns true if the HTML or body element has either the "dir" HTML attribute or the "direction" CSS property set to "rtl".

This is a global function


d3plus.stylize(elem, styles) <>

Applies each key/value in an object as a style.

This is a global function


d3plus.htmlDecode(input) <>

Strips HTML and "un-escapes" escape characters.

This is a global function


d3plus.textWidth(text, [style]) <>

Given a text string, returns the predicted pixel width of the string when placed into DOM.

This is a global function