1 Star 0 Fork 1

苍石 / func-js

加入 Gitee
与超过 800 万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
readme.md

@func-js

The wonderful lib for function in Javascript

Packages

  • @func-js/core: The core js, includes the basic functions and usages.
  • @func-js/async: The enhancement for core js, get to support multi features for async methods.
  • @func-js/utils: The utils for all packages.

Demos

  1. Method Hooker - Live Demo

    If you want to do something before or after the method called, you can using before or after method from @func-js/core module.

    const {give} = require('@func-js/core');
    
    /**
     * Auto parameters by using before
     */
    
    function genInfo(id) {
        return {
            id: id,
            name: 'Info #' + id
        }
    }
    
    var autoGenInfo = give(genInfo)
        .before(function (params) {
            var args = params.args;
            if (!args[0]) {
                args[0] = '88888';
            }
        });
    
    console.log(autoGenInfo());         // > { id: '88888', name: 'Info #88888', autoGen: true }
    console.log(autoGenInfo('4123'));   // > { id: '4123', name: 'Info #4123' }
    
    /**
     * Using after to sign now timestamp for last return value
     */
    
    var signTimeInfo = autoGenInfo.after(
        function (params) {
            var lastValue = params.lastValue;
            lastValue.singTime = Date.now();
            return lastValue;
        }
    );
    
    console.log(signTimeInfo());        // > { id: '88888', name: 'Info #88888', singTime: 1609772675561 }

Documents

Need Contributors

  1. Fork the git repository, and download to local.
  2. Run yarn install to begin your developments.

Git Repository

仓库评论 ( 0 )

你可以在登录后,发表评论

简介

javascript framework for making function powerful 展开 收起
JavaScript
取消

发行版

暂无发行版

func-js

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/HGJing/func-js.git
git@gitee.com:HGJing/func-js.git
HGJing
func-js
func-js
master

搜索帮助