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

ian-an

v1.0.0

Published

a basic library to manage and control function

Downloads

1

Readme

Ian

a basic library to manage and control function

Ian want to cooperates with Modules and connect them to build a extensible and readable program, like that

cooperating with module

In order to achieve this goal, you should understand the simple principle of Ian first.
Requiring Ian and mount a function

const Ian = require('ian');
const ian = new Ian();

ian.mount(fn);

It will give the fn three attributes, input, status and goto

function`s attributes

After that, you can do many things with this function. for example, select the arguments, decide the next function to execute.

Ian provides atomic api to operate function.

FUNDAMENTAL API

  • setFnName(FnName): give function a special name.
  • createArgPool(poolName, isOnce): build an pool to save arguments that function can take from. When isOnce == true, the pool will destory after some function take it.
  • addArgToPool(poolName, ...value): add arguments to some pool. When poolName == false, those value will add to a default global arg-pool.
  • setArgToPool(poolName, ...value):set arguments to some pool. When poolName == false, those value will add to a default global arg-pool.

INPUT API

lian.mount can only recieve non-parameter function, for example, () => console.log('hello world'). There are some other APIs that you can custom your function parameters.

  • acceptLast(fn): When typeof fn !== 'function', the results from last function will pass to this function directly. When typeof fn === 'function', the results from last function will be handled and return to this function.
lian.mount((...lastResult) => {
  console.log(`There are lastResult come from last function: ${lastResult}`);
}).acceptLast();
  • openTo(...fnName): add a build-in argument to function that you can call other functions. If the argument more than one fnName or the first argument is an Array(for example, ['funA', 'funB']), all results will be return by Promise.all. If fnName[0] == false, it will invoke next function.
lian.mount(() => console.log('I am the invoked function')).setFnName('funA');//mount a function and give a name to this function

lian.mount((to) => to()).openTo('funA');//mount a function and give a build-in argument to invoke funA
  • selectArgPool(...poolName): select arg-pools. If poolName[0] == false, it will take the default global arg-pool.
lian.createArgPool('poolA').addArgToPool('poolA', 'argA', 'argB');//create an arg-pool and add two argument to it

lian.mount((argA, argB) => console.log(`I am ${argA}. I am ${argB}`)).selectArgPool('poolA');//mount a function and select poolA as arg-pool

GOTO API