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

@cdoublev/to-cubic

v0.2.7

Published

A function to transform SVG <path> using cubic commands.

Readme

CircleCI

to-cubic

  1. About
  2. Installation
  3. Usage

About

to-cubic transforms the definition of multiple SVG <path>s so that they all use cubic commands and the same number of commands:

Path data animation is only possible when each path data specification within an animation specification has exactly the same list of path data commands as the d attribute.

Current recommandation.

For animation, two d property values can only be interpolated smoothly when the path data strings contain have the same structure, (i.e. exactly the same number and types of path data commands which are in the same order).

Candidate recommandation.

Demo: CodePen.

All command types are supported – m, l, h, v, s, c, q, t, a, z – either relative (lowercase) or absolute (uppercase). The only rule is that a definition should not include a moving command (m or M) that is not the first command.

Installation

  npm i @cdoublev/to-cubic

@cdoublev/to-cubic is built to run in the current version of NodeJS, which means it should be transpiled with your application using its own targets.

Usage

With npx (LTS or current NodeJS version):

npx to-cubic [-r|--round <precision>] <input.(c|m)?js> [output.txt]

The input should be an ECMAScript/CommonJS module whose default/main export is an array containing your path definitions. The result will be forwarded to the standard output, or saved in a file whose path is provided as the second argument.

With import/require:

import toCubic from '@cdoublev/to-cubic'
// Or (CommonJS): const toCubic = require('@cdoublev/to-cubic')

const path = document.getElementById('my-path')
const precision = 4
const [from, to] = toCubic([
    'M0 0h10v10H0z',
    'M5 0A5 5 0 0 0 10 5A5 5 0 0 0 5 10A5 5 0 0 0 0 5A5 5 0 0 0 5 0z',
], 4)

// Animate from square to circle in 2s (using the Web Animation API)
path.animate({ d: [`path('${from}')`, `path('${to}')`] }, 2000)

TODO

  • Performances: measure performances of each processing task