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

node-fn-mgt

v0.0.8

Published

function management - 基于node的,打造用户自己的函数库

Downloads

6

Readme

fnmgt

项目简介

Function Management - 基于node,打造用户自己的函数库

例如,您已编写好了一个 util.js

// util.js

function add(a, b){
    return a + b
}

function mult(a,b){
    return a * b
}

当前,您想在其他工程调用 util.js 中的函数,您需要将该文件或是函数复制到新的工程中

现在,您可以通过 fnmgt 直接在其他工程中调用,如:

const fnmgt = require('fnmgt')

// 这样
fnmgt.add(1, 2)

// 亦或是这样
let mult = fnmgt("mult")
mult(1, 2)

安装说明

  • 通过 npm 安装:

    npm install fnmgt -g

Wasm 支持

  1. 安装 Rust

  2. 安装 npm 包

    npm install wasm-pack


使用说明

JavaScript

  1. 成功安装 fnmgt

  2. 编写好一个 js 文件,如 test.js:

    function add(a, b){
        return a + b
    }
    
    function mult(a,b){
        return a * b
    }
  3. 上传这个文件

    fnmgt upload ./test.js
  4. 在其他工程引入 fnmgt

    const fnmgt = require('fnmgt')
  5. 调用写过的 函数

    // 通过属性的方式调用
    fnmgt.add(1, 2)
    
    // 通过传参的形式调用
    let mult = fnmgt("mult")
    mult(1, 2)
  6. 获取可用的函数列表

    console.log(fnmgt.__getlist__())
    // {
    //     add:  {js: true, wasm: false},
    //     mult: {js: true, wasm: false},
    // }

Wasm(暂不支持)

  1. 打包好一个 test.wasm 文件后,同样可以通过 fnmgt 上传

    fnmgt upload ./test.wasm
  2. 在其他工程引入 fnmgt

    const fnmgt = require('fnmgt')
  3. 获取 wasm 文件

    // 通过传参的形式调用
    let testWasm = fnmgt("test", "wasm")
  4. 调用 wasm 文件中的函数

    const buffer = await testWasm.arrayBuffer();
    const { instance } = await WebAssembly.instantiate(buffer);
    
    // 调用 Wasm 模块中的函数
    const result = instance.exports.add(1, 2);