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

findnrjs

v1.1.6

Published

this is a js tools:create tree,find nodes,create animate

Downloads

34

Readme

findnrjs

This is a tools,create tree ,find node, create animate

说明:这是一个 js 常用小工具,以下是使用用方法 #安装

npm install --save findnrjs

增加企业统一信用代码,身份证号,手机号,银行卡的验证

import {Num} from "findnrjs";
Num.check.IdCard()
Num.check.UnitCard()
Num.check.BankCard()
Num.check.Phone()

v 1.1.4

增加浏览器本地存储操作(localStorage)

import {Local} from "findnrjs"

事例

let obj = {token:'fds',name:'test'}
//写入
Local.set(obj)
//获取取
Local.get('token')
//删除
Local.del('token')
//清空
Local.clear()

v 1.1

增加时间接口

import {Time} from "findnrjs"

事例

/*
* 参数为Object (不是必传,不传参数时获取到本机的时间进行格式化)
* 参数说明 {time:1627974788,type:'d,t,w',lang:'zh'} => time:时间戳 type: d 代表日期 ,t代表时间 ,w代表星期 lang: zh 代表中文字 en是-
*/
let time = Time.format({time:1627974788,type:'d,t,w',lang:'zh'}) //2021年8月3日 15:13:8 星期二
let time = Time.format({time:1627974788,type:'d,t',lang:'en'})//2021-8-3 15:13:8
let time = Time.format({time:1627974788})//2021年8月3日 15:13:8 星期二
let time = Time.format()//2021年8月3日 15:13:8 星期二

v 1.0

现有的函数

import {CreateNodeTree,FindNodeTree,CreateFloatAnimation} from "findnrjs"

CreateNodeTree() 无限级栏目分类

第一个参数是原始数据:结构如下

let data =[
            {test_id:'1',name:"书",parent_id:0},
            {test_id:'2',name:"编程开发",parent_id:1},
            {test_id:'3',name:"javascript开发书",parent_id:2},
            {test_id:'4',name:"其它",parent_id:0}
           ];

第二个参数是 id 的名称:test_id

第三个参数是从第几级开始生成树,这里是 0

第四个参数产生子节点时生成的名称,这里是 children

第五个参数父 ID 的名称,这里是 parent_id

CreateNodeTree(data=[], idName = "test_id",topId=0,nodesName="children",parentName="parent_id")

返回的结果是:

let newData=[
            {test_id:'1',name:"书",parent_id:0,
                children:[
                    {test_id:'2',name:"编程开发",parent_id:1,
                        children:[
                            {test_id:'3',name:"javascript开发书",parent_id:2}
                        ]
                    }
                ]
            },
            {test_id:'4',name:"其它",parent_id:0}
        ]

FindNodeTree() 通过层级数据查找对应的元素

第一个参数是原始数据:结构如下

let newData=[
            {test_id:'1',name:"书",parent_id:0,
                children:[
                    {test_id:'2',name:"编程开发",parent_id:1,
                        children:[
                            {test_id:'3',name:"javascript开发书",parent_id:2}
                        ]
                    }
                ]
            },
            {test_id:'4',name:"其它",parent_id:0}
        ]

第二个参数是 id 的名称:test_id

第三个参数层级数据这里举个例子:[1,2,3]

第四个参数产生子节点时生成的名称,这里是 children

FindNodeTree(data = [],idName = "",idArr = [],nodeName = "children")

返回的结果是:

let newData={test_id:'3',name:"javascript开发书",parent_id:2}

CreateFloatAnimation() 创建一个页面漂浮的动画

参数是个对象

{
    className: false, //必须传(元素名称)
    speed: 30, //速度
    width: 20, //关闭按钮的宽
    height: 20,//关闭按钮的高
    background: "none", //背景颜色
    innerHtml: "x", //按钮的内容
    fontSize: 10, //字体的大小
    color: "#000" //字体的颜色
}
<div class="test">
</div>
CreateFloatAnimation({className:".test"});
<div id="test">
</div>
CreateFloatAnimation({className:"#test"})