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-json-jstore

v1.0.5

Published

nv-json-jstore ======================= - record json operation to 4 words: cd | pr | set | rm - for share very-big-json-env using (record append only)

Downloads

13

Readme

nv-json-jstore

  • record json operation to 4 words: cd | pr | set | rm
  • for share very-big-json-env using (record append only)

install

  • npm install nv-json-jstore

splitted

usage

  const x   = require("nv-json-jstore");

example

/*
> x.JStore.prototype
{
  impl_fwdcast: [Function (anonymous)],              // your need to impl fwdcast:  
                                                         //    When server receive a <operation/ir>  FROM one-client
                                                         //       First: server will sync-to-<disk>
                                                         //       Then:  server will forward <operation/ir> TO all-other-clients                    
  impl_broadcast: [Function (anonymous)],           // your need to impl broadcast
                                                        //     When server do <operation/ir> (for example : from cli-command OR repl)
                                                        //         First: server will sync-to-<disk>
                                                       //          Then:  server will broadcast <operation/ir> TO all-clients

      '#dispatch_one_srv_action': [Function (anonymous)],
      '#dispatch_many_srv_action': [Function (anonymous)],
      "#exec_and_dispatch_many_srv_action" : [Function (anonymous)],
  '#dispath_srv_action': [Function (anonymous)],  // no need, internal func


  pr: [Function (anonymous)],  // ir 1   goto parent
  cd: [Function (anonymous)],  // ir 2   goto direct child
  set: [Function (anonymous)], // ir 3   update OR add
  rm: [Function (anonymous)],  // ir 4   delete


      _exec_one_ir_and_sync_to_disk: [Function (anonymous)],
  _recv_from_src_client: [Function (anonymous)],  // this is for call in http/ws handle        
                                                       
                                           // wrapped API for convinience:

  '$set_then_cd': [Function (anonymous)],
  '$flat_set': [Function (anonymous)]
}
*/

    var jstore = x.creat();
    jstore.disk.write  = function (ir) {console.log("ir:",ir)}  // your need to impl your-own <Disk> MUST have 2 methods: write | finish
                                                                //   normally JUST use a <FileWriteStream>  OR <Blob> is OK (you need impl the json-stream parser)
                                                                //   in practice 
                                                                //        USING a database(postgres) OR a shared-mem(best) OR msg-queue 
    

	jstore.set("k1",100)
	//ir: [ 'set', 'k1', 100 ]
	jstore.set("k2",{})
	//ir: [ 'set', 'k2', {} ]
	/*
	> jstore
	JStore { ver: 3, rt: { k1: 100, k2: {} }, pl: [] }
	> 
	*/

	jstore.cd("k2")
	/*
	> jstore.cd("k2")
	ir: [ 'cd', 'k2' ]

	> jstore
	JStore { ver: 4, rt: { k1: 100, k2: {} }, pl: [ 'k2' ] }
	>
	*/

	jstore.$flat_set("k3",[1.1,"s",true,null,false,{a:"ss",b:"sss"}])

	/*
	> jstore.$flat_set("k3",[1.1,"s",true,null,false,{a:"ss",b:"sss"}])
	
	ir: [ 'set', 'k3', [] ]
	ir: [ 'cd', 'k3' ]
	ir: [ 'set', 0, 1.1 ]
	ir: [ 'set', 1, 's' ]
	ir: [ 'set', 2, true ]
	ir: [ 'set', 3, null ]
	ir: [ 'set', 4, false ]
	ir: [ 'set', 5, {} ]
	ir: [ 'cd', 5 ]
	ir: [ 'set', 'a', 'ss' ]
	ir: [ 'set', 'b', 'sss' ]
	ir: [ 'pr' ]
	ir: [ 'pr' ]

	> jstore
	JStore { ver: 17, rt: { k1: 100, k2: { k3: [Array] } }, pl: [ 'k2' ] }
	> jstore.rt.k2.k3
	[ 1.1, 's', true, null, false, { a: 'ss', b: 'sss' } ]
	> 
	> 

	/*
	> jstore.cd("k3")
	ir: [ 'cd', 'k3' ]

	> jstore
	JStore {
	  ver: 18,
	  rt: { k1: 100, k2: { k3: [Array] } },
	  pl: [ 'k2', 'k3' ]
	}
	> jstore.curr
	[ 1.1, 's', true, null, false, { a: 'ss', b: 'sss' } ]
	> 
	> jstore.cd(5)
	ir: [ 'cd', 5 ]
	> jstore.curr
	{ a: 'ss', b: 'sss' }
	> 
	> jstore.rm("a")
	ir: [ 'rm', 'a' ]

	> jstore.
	... 
	> jstore
	JStore {
	  ver: 19,
	  rt: { k1: 100, k2: { k3: [Array] } },
	  pl: [ 'k2', 'k3', 5 ]
	}
	> jstore.pr()
	ir: [ 'pr' ]

	> jstore
	JStore {
	  ver: 20,
	  rt: { k1: 100, k2: { k3: [Array] } },
	  pl: [ 'k2', 'k3' ]
	}
	> jstore.pr()
	ir: [ 'pr' ]

	> jstore
	JStore { ver: 21, rt: { k1: 100, k2: { k3: [Array] } }, pl: [ 'k2' ] }
	> 
	> jstore.pr()
	ir: [ 'pr' ]

	> jstore
	JStore { ver: 22, rt: { k1: 100, k2: { k3: [Array] } }, pl: [] }
	> 
	> 
	*/

METHODS

    jstore.impl_broadcast                 jstore.impl_fwdcast
jstore.$flat_set                      
    jstore.$set_then_cd                   
    jstore._exec_one_ir_and_sync_to_disk  jstore._recv_from_src_client
jstore.cd                                                
jstore.pr                             
    jstore.rm                             
    jstore.set

    // getters

jstore.clients                        jstore.curr                           jstore.disk                           jstore.pl
jstore.rt                             jstore.ver

APIS

	{
	  DummyInitEnv: [class DummyInitEnv],
	  DummyDisk: [class DummyDisk],
	  JStore: [Function: JStore],
	  is_irary: [Function: is_irary],
	  creat_pr_ir: [Function: creat_pr_ir],
	  creat_cd_ir: [Function: creat_cd_ir],
	  creat_set_ir: [Function: creat_set_ir],
	  creat_rm_ir: [Function: creat_rm_ir],
	  creat_flat_set_irs: [Function: creat_flat_set_irs],
	  pr: [Function: pr],
	  cd: [Function: cd],
	  set: [Function: set],
	  rm: [Function: rm],
	  exec_one_ir: [Function: exec_one_ir],
	  exec_irs: [Function: exec_irs],
	  exec_irs_with_each_ircb: [Function: exec_irs_with_each_ircb],
	  creat: [Function: creat]
	}

LICENSE

  • ISC