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

@xysfe/util

v1.0.7

Published

``` npm i @xysfe/util -S ``` ## 使用 ##### 全量引用 ```javascript import { getParameter } from '@xysfe/util' ``` ##### 局部引用 ```javascript import getParameter from '@xysfe/util/lib/getParameter' ``` ##### 使用babel插件 安装插件 ``` npm i babel-plugin-impo

Downloads

32

Readme

@xysfe/util

文档

起步

安装

npm i @xysfe/util -S

使用

全量引用
import { getParameter } from '@xysfe/util'
局部引用
import getParameter from '@xysfe/util/lib/getParameter'
使用babel插件

安装插件

npm i babel-plugin-import-muc -D

添加babel配置

// babel 配置
// babel.config.js
module.exports = {
  "plugins": [
    [
      "import-muc",
      {
        "libraryName": "@xysfe/util",
        "style": false,
        "transformToDefaultImport": false
      }
    ]
  ]
}
import { getParameter } from '@xysfe/util'

该语法会被转义为

const getParameter = require('@xysfe/util/lib/getParameter') 

如何贡献

控制台命令添加模块
npm run add [模块名称]

测试用例

使用的是 Jest

发布相关

npm源更改

  1. 设置使用淘宝cnpm
npm config set registry https://registry.npm.taobao.org
  1. 查看是否配置成功,成功后即可直接使用cnpm命令
npm config get registry
  1. 还原npm仓库
npm config set registry https://registry.npmjs.org

文档维护

  • 文档用 apidoc 自动生成,打包会在doc目录生成文档资源。

  • 资源上传到dev环境static/xysUtil/

  • xysuitl-doc.html需要单独上传到application/Home/View/Docs/

    在调用函数前面用注释,参照以下格式*

    /**
     * @api {function} cloneDeep cloneDeep
     * @apiName cloneDeep
     * @apiVersion 0.1.0
     * @apiDescription 深拷贝
     * @apiGroup cloneDeep
     * @apiParam {any} target 拷贝的对象
     * @apiSuccess (返回值) {any} val 返回值
     * @apiExample {js} 使用:
     *     cloneDeep() // 结果
     *
     */
    export default function cloneDeep(target: any, map = new WeakMap()) {
        ...
    }

参数说明:

  • @api {类型} 路径(可随意填,但必须) 名称
  • @apiName: 名称(用于url上面显示)
  • @apiVersion:版本
  • @apiGroup 组别(用于主导航显示)
  • @apiParam 入参类型 入参名称 描述 (多个参数用多行apiParam)
  • @apiSuccess 返回值类型 返回值名称 返回值描述
  • @apiExample api的使用方式,例子

具体注释规则可查看:https://apidocjs.com/#param-api-param-example