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

reg-invoker

v1.3.0

Published

Registry invoker is a generic JavaScript base to manage communications between your instances & offer an internal registry to store & exchange your values.

Downloads

5

Readme

Registry invoker

Registry invoker is a generic JavaScript base to manage communications between your instances & offer an internal registry to store & exchange your values.

Table of contents

Install

On Node.js : npm install reg-invoker

On browsers :

<script src="https://raw.github.com/Lcfvs/reg-invoker/master/reg-invoker.min.js"></script>

Usage

var regInvoker,
    closure,
    instance;

regInvoker = require('reg-invoker');

closure = function closure(instance, internalRegistry) {
    instance.getInternalRegistry = function getInternalRegistry() {
        return internalRegistry;
    };
    
    instance.publicRegistry = internalRegistry.create();
    
    return instance;
};

instance = regInvoker.invoke(closure);

Reference :

###regInvoker

@instance @static: {Object} regInvoker
@description: a reg-invoker instance
@see: `instance`
@method @readonly: {Function} invoke(closure)
    @see: `regInvoker.invoke(closure)`
    
@property @readonly: {Object} registry
    @description: generated on the fly on first value call
    
    @see: `registry`

###regInvoker.invoke(closure)

@description: creates a pre-built instance with a parents <-> childs communication and an internal registry

@param: {Function} closure
    @see: `closure`
    
@return: {*} closureValue
    @description: the closure return value

###closure

@instance: {Function} closure
@description: the function that receives a pre-built instance and the internal registry

@param: {Object} instance
    @see: `instance`
    
@param: {Object} internalRegistry
    @description: private registry, only known by instance and
    @description: parents & childs & copies registries 
    
    @see: `registry`

###instance

@instance: {Object} instance
@description: a pre-built instance

@method: parent()
    @description: returns the parent instance, if any
    
    @see: `instance`
    
    @return {Object|undefined} parentInstance
    
@method: child(name)
    @description: returns the named child instance, if any
    
    @see: `instance`
    
    @param: {String} name
        @description: the child name of the related instance
        
    @return {Object|undefined} childInstance
    
@method: children()
    @description: returns all the named child instances
    
    @see: `instance`
    
    @return {Object} childrenInstances
    
@method: create()
    @description: creates an orphan instance
    @description: has no parent
    @description: calls the closure
    
    @see: `instance`
    
    @return {Object} orphanInstance
    
@method: copy()
    @description: copies the related instance
    @description: shares the same registry with the related instance
    @description: not registered as a child of an instance
    @description: no closure call
    
    @see: `instance`
    
    @return {Object} instanceCopy
    
@method: fork(name)
    @description: creates an instance
    @description: has a parent
    @description: is registered as a child of the related instance, if a name is specified
    @description: calls the closure
    
    @see: `instance`
    
    @param @optional: {String} name
        @description: the child name of the related instance
    
    @return {Object} childInstance
    
@method: name()
    @description: returns the instance name, if any
        
    @return {String} name | undefined

###registry

@instance: {Object} registry
@description: a registry

@method: parent()
    @description: returns the parent registry, if any
    
    @see: `registry`
    
    @return {Object|undefined} parentRegistry
    
@method: child(name)
    @description: returns the named child registry, if any
    
    @see: `registry`
    
    @param: {String} name
        @description: the child name of the related registry
        
    @return {Object|undefined} childRegistry
    
@method: children()
    @description: returns all the named child registries
    
    @see: `registry`
    
    @return {Object} childrenRegistries
    
@method: create()
    @description: creates an orphan registry
    @description: has no parent
    @description: calls the closure
    
    @see: `registry`
    
    @return {Object} orphanRegistry
    
@method: copy()
    @description: copies the related registry
    @description: shares the same registry with the related registry
    @description: not registered as a child of an registry
    
    @see: `registry`
    
    @return {Object} registryCopy
    
@method: fork(name)
    @description: creates a registry
    @description: has a parent
    @description: is registered as a child of the related registry, if a name is specified
    @description: calls the closure
    
    @see: `registry`
    
    @param @optional: {String} name
        @description: the child name of the related registry
    
    @return {Object} childRegistry
    
@method: init(name, value)
    @description: creates a record with the chosen name, in the registry, with the related value
    @description: returns the current stored value
    
    @param: {String} name
        @description: the named record in the related registry
    
    @param: {String} value
        @description: the value of named record in the related registry
        @description: ignored if the named record already exists
    
    @return {*} recordedValue
    
@method: has(name)
    @description: creates a record with the chosen name, in the registry, with the related value
    @description: returns if the named record exists
    
    @param: {String} name
        @description: the named record in the related registry
    
    @return {Boolean} recordExists
    
@method: get(name, defaultValue)
    @description: returns a record value with the chosen name, in the registry
    
    @param: {String} name
        @description: the named record in the related registry
    
    @param @optional: {String} defaultValue
        @description: the return value if registry has no record for the specified name
    
    @return {*} recordedValue
    
@method: set(name, value)
    @description: wrotes a record with the chosen name, in the registry, with the related value
    @description: returns the registry
    
    @param: {String} name
        @description: the named record in the related registry
    
    @param: {String} value
        @description: the value of named record in the related registry
        
    @return {Object} registry
    
@method: add(name, value)
    @description: adds a value to a record with the chosen name, in the registry, with the related value
    @description: an array is recorded as the record value, if no record for the specified name
    @description: returns the record value
    
    @param: {String} name
        @description: the named record in the related registry
    
    @param: {String} value
        @description: the value stored in the named record in the related registry
        
    @return {Object} registry
    
@method: unset(name)
    @description: deletes a record with the chosen name, in the registry, with the related value
    
    @param: {String} name
        @description: the named record in the related registry
        
    @return {Object} registry
    
@method: name()
    @description: returns the registry name, if any
        
    @return {String} name | undefined
    
@method: share(closure, registry)
    @description: returns the registry name, if any
        
    @param: {String} closure
        @see: `closure`
        
    @param @optional: {Function} registry
        @see: `closure`
        
    @return {*} closureValue
        @description: the closure return value

License

This project is under the MIT license