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

extract-svg-viewbox

v1.0.1

Published

Extract the viewBox content from an SVG string

Downloads

606

Readme

extract-svg-viewbox

Build Status Build Status npm npm npm

Extracts the viewBox information from an SVG string.

Install

npm i --save extract-svg-viewbox

Usage

const extract = require('extract-svg-viewbox')

const svg = `<svg viewBox="0 0 460 460" xmlns="http://www.w3.org/2000/svg">
  <path
    d="M7.121 178.853c-5.07 14.157-.924 28.755 11.058 38.49l84.783 67.251c1.845 1.327 2.303 3.541 1.845 5.751l-25.803 101.319c-3.227 10.616-.922 21.676 5.988 30.086 6.912 8.846 17.97 14.157 29.03 14.157 6.91 0 13.823-2.212 19.351-5.753l92.618-55.304c1.843-.883 4.147-.883 5.99 0l93.537 55.304c5.99 3.982 12.902 5.753 19.813 5.753 10.598 0 21.199-4.867 28.11-13.274 6.91-8.406 9.674-19.466 7.371-30.528l-25.803-101.761c-.46-2.212.46-4.424 1.843-5.751l85.245-67.693c11.52-9.735 15.666-24.331 11.06-38.49-5.072-13.719-17.512-23.008-32.257-23.894l-109.666-7.521c-2.301 0-4.146-1.329-5.066-3.539l-41.931-97.335c-5.992-13.719-18.894-22.123-34.098-22.123-15.207 0-28.57 8.404-34.098 22.123l-41.932 97.775c-.922 1.77-2.763 3.099-5.068 3.541l-109.206 7.079c-14.743.885-27.646 10.175-32.713 24.335z" fill="transparent" />
</svg>`

const viewBox = extract(svg)
console.log(viewBox) // "0 0 460 460"

License

MIT © Luke Mitchell