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

nv-string-size

v1.0.4

Published

nv-string-size ======================= - same as String'length , But with more info - String'length is very boring

Downloads

6

Readme

nv-string-size

  • same as String'length , But with more info
  • String'length is very boring

install

  • npm install nv-string-size

usage

  const { size}   = require("nv-string-size");

example

0

       var s =`\x00 \b\t\n\f\r ' " \\ a \xff 我 𝑒`;
       var sz = size(s);

        console.log(sz)


	    Size {
	      nul: 1,
	      btnfr_esc_q: 7,
	      _1to7_11_14to31: 0,
	      _32_33_35to38: 8,
	      sq: 1,
	      _40to91_93to127: 1,
	      _128to255: 1,
	      _256to2047: 0,
	      _2048to55295: 1,
	      hi: 1,
	      lo: 1,
	      _57344to65535: 0
	    }
	    
	    /*
	    > sz.u81                   
	    18
	    > sz.u82                   
	    1
	    > sz.u83                   
	    1
	    > sz.u84
	    1
	    > sz.u8_blen
	    27
	    > 
	    > Buffer.from(s).length
	    27
	    > 
	    
	    > sz.is_u813_only ()
	    false
	    > sz.is_u81_only()
	    false
	    > 
	    */
	    
	    /*
	    > sz.latin1
	    19
	    > 
	    */
	    
	    /*
	    sz.u16_2                 
	    sz.u16_4 
	    sz.is_perfect_u16()    
	    */
	    
	    /*
	    > sz.is_perfect_json()
	    false
	    
	    > sz.json_slen 
	    34
	    > 
	    > JSON.stringify(s)
	    `"\\u0000 \\b\\t\\n\\f\\r ' \\" \\\\ a ÿ 我 𝑒"`
	    > 
	    > JSON.stringify(s).length -2
	    34
	    > 
	    
	    > sz.json_blen             
	    39
	    > Buffer.from(JSON.stringify(s)).length -2
	    39
	    > 
	    
	    
	    
	    */     
		      
			
	    /*
	    sz.is_valid_pg()
	    false                 //coz has \x00 
	    */
	    
	    
	    /*
	    > s="a ' b"
	    "a ' b"
	    > 
	    > sz = size(s)
	    Size {
	      nul: 0,
	      btnfr_esc_q: 0,
	      _1to7_11_14to31: 0,
	      _32_33_35to38: 2,
	      sq: 1,
	      _40to91_93to127: 2,
	      _128to255: 0,
	      _256to2047: 0,
	      _2048to55295: 0,
	      hi: 0,
	      lo: 0,
	      _57344to65535: 0
	    }
	    > 
	    > sz.is_perfect_pg()             // coz has  '                
	    false
	    > sz.pg_blen               
	    6
	    > sz.pg_slen
	    6
	    > 
	    */
	    
	    /*
	    
	    */

METHODS

	sz.is_perfect_json       sz.is_perfect_pg         sz.is_perfect_u16        sz.is_u813_only          sz.is_u81_only
	sz.is_valid_pg           sz.json_blen             sz.json_slen             sz.latin1                sz.pg_blen               sz.pg_slen
	sz.u16_2                 sz.u16_4                 sz.u81                   sz.u82                   sz.u83                   sz.u84
	sz.u8_blen


            
	sz._128to255             sz._1to7_11_14to31       sz._2048to55295          sz._256to2047            sz._32_33_35to38         sz._40to91_93to127
	sz._57344to65535         sz.btnfr_esc_q           sz.hi                    sz.lo                    sz.nul                   sz.sq

APIS

	{
	  size: [Function: size],
	  patch: [Function: patch],
	  depatch: [Function: depatch]
	}

LICENSE

  • ISC