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

ljytoolsnew

v0.0.5

Published

tools repositories 最新一版 之前一版没有再用了

Downloads

14

Readme

ljyTools

说明

写Js也有一段时间了,将平时和工作中遇到的一些繁琐的操作进行封装,在后面遇到的时候可以快速的调用。整个库用webpack4进行打包,打包成library库发布至npm库。

Installation

$ npm i -g npm
$ npm i ljytoolsnew --save  

repositories

仓库地址 :

https://github.com/ljylhm/ljyTools.git

import

var {verify,object,util} = require("ljytoolsnew");

examples

[Object Array] [Object String] [Object Number] [Object Object] .....

    var t = 1;
    verify.getDataType(t); // Number
    var s = "1";
    verify.getDataType(t); // String

isNumber

    var t = 123;
    verify.isNumber(t); // true
    var s = "张三";
    verify.isNumber(s); // false

isBoolean

    var t = true;
    verify.isBoolean(t); // true
    var s = "李四";
    verify.isNumber(s); // false
    var o = new Object();
    verify.isNumber(o); // false

isObject

    var t = {
        "a":"321"
    };
    verify.isObject(t) // true
    var t = function(){
        console.log(123);
    }
    verify.isObject(t) // 

isDate

var t = new Date();
verify.isDate(t); // true

[isFile] [isBlob] [isArray] 方法使用同上

storage

对本地存储的封装

session类 localStroage类的封装

 sesssionStorage  ||    localStroage
 ==============   ||    ============= 
 sessionSet       ||    localStroageSet
 sessionGet       ||    localStroageGet  
 sessionClear     ||    localStroageClear
      
// 设置 session
storage.sessionSet();

// 获得 session
storage.sessionGet();

// 清除 session 如果不指定 清除全部的session
storage.sessionClear();

==============================

// 设置 localStroage
storage.localStroageSet();

// 获得 localStroage
storage.localStroageGet();

// 清除 localStroage 如果不指定 清除全部的localStroage
storage.localStroageClear();

url

对链接的封装

// 返回当前页面的链接
url.getUrl();  "https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=0&rsv_idx=1&tn=baidu&wd=tengxun%20&rsv_pq=be5accd300021937"
// 返回当前页面的主机名
url.getHost();  "www.baidu.com"
/**
 * @description 返回一个链接的hash值 没有指定连接的时候返回当前页面的hash
 * @returns {String} hash值
 * @example getHash(https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=split()#index) => index
 */

url.getHash();  "#t=1"
url.getHash("https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=split()#index") "index"
 /**
   * @description 设置和替换hash值
   * @param {url} 链接 
   * @param {hash} 设置的hash值 
   * @returns {String} hash值
   * @example setHash(https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=split()#index,'index1') 
   * => https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=split()#index1
 */

url.setHash('https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=split()#index','index1');

// return https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=split()#index1
/**
 * @description 获取url中的search
 * @returns {String} search值
 */
url.getSearchParam("https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=split()#index")

return "ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=split()"
/**
 * @description 获取search中的值
 * @returns {String} search值
 * @example getUrlParam(https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=split()#index,ie) => ut8
 */
 
url.getUrlParam("https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=split()#index","ie");

// 返回 utf-8
/**
 * @description 获取search中的值
 * @param {url} 当前链接
 * @param {data} 需要设置的param对象
 * @returns {String} search值
 * @summary 此方法可以获取正常情况下的链接 对于单页面应用 设置的#号 "?" 无效
 * @summary 生成的链接完全查询值 完全依赖 data中的param对象 原有的查询值会被覆盖 但原来的链接不变
 */
setUrlParam("https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=split()#index",{
    a:"123",
    b:"123"
})

return "https://www.baidu.com/s?a=123&b=321#index"