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

neigri-tools

v1.0.3

Published

neigri个人工具库

Downloads

4

Readme

neigri-tools

neigri的前端工具库

Install

This project uses node and npm or yarn. Go check them out if you don't have them locally installed.

npm install neigri-tools

yarn add neigri-tools

目录结构描述

├── Readme.md // help ├── app // 应用 ├── config // 配置 │ ├── webpack.config // 公共配置 │ ├── webpack.dev.config.js // 开发环境 │ ├── webpack.prod.config.js // 生产环境 ├── src │ ├── components // 测试用组件页面 │ ├── store // 测试状态管理 │ ├── tools // 主要打包内容

Usage

导出模块可使用 import, require, 目前工具库中有: 1.获取url上参数, url目标链接, key详细的目标健值(可选) 没有就会将所有参数输出

import { getUrlParam } from 'neigri-tools'

const param = getUrlParam(url, key)

2.过万处理处理 大于 9999 显示 xx.x万

import { million } from 'neigri-tools'

let val = 10000

million(val)    //1.0万 

3.个人分享 集合了qq,微博,qq空间,facebook,twitter等第三方分享功能。 facebook和twitter配置项除了url链接有效外无法配置其他选项,它们有自己一套抓取页面的标准。

import { share } from 'neigri-tools'

share.config({
  url = '',   //分享的链接  
  desc = '',  //默认分享理由(可选)
  summary = '', //分享摘要(可选)
  title = '',//分享标题(可选)
  pics = '', //分享图片的路径(可选)
})

 //  分享到qq空间  
 share.shareQQZone()

 //  分享到qq好友
 share.shareQQ()

 //  分享到微信 callback 回调函数 微信没有第三方分享 pc端调用此方法会生成链接二维码 callback是处理移动调用此方法时的自定义处理
 share.shareWeChat(callback)

 //  分享到微博
 share.shareWebo()

 //  分享到twitter
 share.shareTwitter()

 //  分享到facebook
 share.shareFB()

4.个人业务的头像处理(可无视)

import { getAvatarUrl } from 'neigri-tools'

const info = {
  headIndex:1,
  SkinID?:1,
  Model? : 1
}

getAvatarUrl(info)

5.两个对象深度对比

import { deepEqual } from 'neigri-tools'

deepEqual(x, y)

6.深度拷贝对象

import { deepCopy } from 'neigri-tools'

const newObj = deepCopy(obj)

7.基于react hook 的全局状态管理器

// store.js

import { Crdux } from 'neigri-tools'

const actions = {
  setCount( setState, data){
    setState( {count: data})
  },
  setKeys( setState , data){
    setState( state =>{
      state.keys ++;
      return state
    } )
  },
};

const store = {
  count: {
    index: 1,
    keys: {
      index: 1
    }
  },
  keys: 1
}

export default Crdux(store, actions)

使用方式

import Crdux from './store.js'

const [store, actions] = Crdux(['count', 'keys'])

const { count, keys } = store

const { setCount, setKeys } = actions