This package has been deprecated

Author message:

intergrated-into-nvlang-and-this-is-useless-now

nv-facutil-curry

1.0.5 • Public • Published

nv-facutil-curry

  • inspect a non-native function-params/arguments
  • currify-a-function similiar to lodash-curry,with more arguments-infomation

install

  • npm install nv-facutil-curry

usage

> var wrap = require("nv-facutil-curry")
undefined
> function tst0(a,b,c) { console.log(a,b,c)}
undefined
> var f = wrap(tst0)
> f.$check()
[
  'a',
  'b',
  'c',
  is_last_rest: false,
  required_num: 3,
  total_param_num: 3,
  is_native: false
]
>
> f(100)
[Function: f] {
  '$name_cache': { a: 100 },
  '$reset': [Function],
  '$exec': [Function],
  '$check': [Function]
}
> f(200)
[Function: f] {
  '$name_cache': { a: 100, b: 200 },
  '$reset': [Function],
  '$exec': [Function],
  '$check': [Function]
}
> f(300)
100 200 300
undefined
>



> function tst1(a,b,c=5) { console.log(a,b,c)}
undefined
> var f = wrap(tst1)
undefined
> f.$check()
[
  'a',
  'b',
  'c = 5',
  is_last_rest: false,
  required_num: 3,
  total_param_num: 3,
  is_native: false
]
> f(100,200)
[Function: f] {
  '$name_cache': { a: 100, b: 200 },
  '$reset': [Function],
  '$exec': [Function],
  '$check': [Function]
}
> f(300)
100 200 300
undefined
> f
[Function: f] {
  '$name_cache': {},
  '$reset': [Function],
  '$exec': [Function],
  '$check': [Function]
}
>


> function tst2(a,b,c=5,...d) {console.log(a,b,c,...d)}
undefined
> var f = wrap(tst2)
undefined
> f(100,200,300)
[Function: f] {
  '$name_cache': { a: 100, b: 200, 'c = 5': 300 },
  '$reset': [Function],
  '$exec': [Function],
  '$check': [Function]
}
> f(400,500)
[Function: f] {
  '$name_cache': { a: 100, b: 200, 'c = 5': 300, '...d[0]': 400, '...d[1]': 500                     },
  '$reset': [Function],
  '$exec': [Function],
  '$check': [Function]
}
> f.$exec()
100 200 300 400 500
undefined
> f
[Function: f] {
  '$name_cache': { a: 100, b: 200, 'c = 5': 300, '...d[0]': 400, '...d[1]': 500                     },
  '$reset': [Function],
  '$exec': [Function],
  '$check': [Function]
}
> f.$reset()
undefined
> f
[Function: f] {
  '$name_cache': {},
  '$reset': [Function],
  '$exec': [Function],
  '$check': [Function]
}
>

property

  • f.$name_cache check-arguments-cache

methods

  • f.$check() check-params
  • f.$reset() clear-arguments-cache
  • f.$exec() exec-function-forcefully even-if with no-enough-arguments-collected

IN TS

@#ts-node
> import * as lib from "@babel/parser"
{}
> import * as wrap  from "nv-facutil-curry"
undefined
> var f = wrap(lib.parse)
undefined
> f.$check()
[
  'input',
  'options',
  is_last_rest: false,
  required_num: 2,
  total_param_num: 2,
  is_native: false
]
> .exit

LICENSE

  • ISC

Package Sidebar

Install

npm i nv-facutil-curry

Weekly Downloads

0

Version

1.0.5

License

ISC

Unpacked Size

7.37 kB

Total Files

3

Last publish

Collaborators

  • ihgazni2