type_dispatch:基于参数类型的多方法调度

时间:2021-07-03 15:35:40
【文件属性】:
文件名称:type_dispatch:基于参数类型的多方法调度
文件大小:4KB
文件格式:ZIP
更新时间:2021-07-03 15:35:40
JavaScript type_dispatch 允许函数根据参数类型分派到其他函数 用法 var type_dispatch = require ( 'type_dispatch' ) ; function A ( ) { } function B ( ) { this . name = "BBB" ; } A . prototype . method1 = type_dispatch ( [ ] , function ( ) { console . log ( "no args" ) ; } , [ String , B ] , function ( a_string , instanceOfB ) { console . log ( "got two args: " , a_string , instanceOfB ) ; } ) ; var a = new A ( ) ; a
【文件预览】:
type_dispatch-master
----LICENSE(1KB)
----test()
--------test.js(1KB)
----README.md(889B)
----.gitignore(541B)
----index.js(2KB)
----package.json(699B)

网友评论