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

mll-utils

v2.0.0

Published

wizlong utils package

Downloads

4

Readme

wiz-utils

目录

概述

wiz-utils是wizlong的工具库,主要存放一些公共的工具。

安装

npm install git+https://gitlab.wizlong.com/sgm/wiz-utils.git

使用

    import { log, generateUUID } from 'wiz-utils'
    

    log.info('wiz-utils so good!');
    //17:19:26.565 INFO   wiz-utils so good! 
    
    
    log.info('generateUUID:',generateUUID());
    //17:33:23.112 INFO   generateUUID: a3239a7b-f816-460f-85da-01b1d17c09cb

许可证

MIT Copyright (c) 2018 - forever Naufal Rabbani

工具介绍

log

log是一个在Console输出日志的工具,类似于console.log('...')

用法

    import { log } from 'wiz-utils'

    log.info('输出:', '123');
    log.warn('输出:', {a:123});
    log.error('输出:', ['a',1,()=>{}]);
    log.debug('输出:', new Map());
    log.trace('输出:', e);

network

network是网络检查工具,目前提供了两个方法

用法

  1. 获得当前网络状态getNetworkState
    import { network } from 'wiz-utils'
    
    if(network.getNetworkState()){
        log.info('网络畅通!')
    }else{
        log.info('断线了!')
    }
  2. 设置网络情况监听startNetInfoListerner
    import { network } from 'wiz-utils'
    
    network.startNetInfoListerner((connection) => {
        if (connection) {
            log.info('网络畅通!')
        } else {
            log.info('断线了!')
        }
    });
    

dateUtils

dateUtils是日期格式化工具

用法

    import { dateUtils } from 'wiz-utils'

    dateUtils.formatDate(new Date(),'yyyyMMdd');
        
    dateUtils.formatDate(new Date(),'yyyyMMddhhmmss')

Storage

Storage是window中localStorage的封装

用法

    import { Storage } from 'wiz-utils'

    Storage.setStorage('mll','mll so cool')
    
    Storage.getStorage('mll')

Session

Session是window中sessionStorage的封装

用法

    import { Session } from 'wiz-utils'

    Session.add('mll','mll so cool')

    Session.get('mll')

    Session.getAll()

getType

通过getType可以获得对象的类型,返回的类型有 'Number', 'String', 'Undefined', 'Boolean', 'Object', 'Array', 'Function', 'Null'

用法

    import { log, getType } from 'wiz-utils'

    log.info('“abc” 类型是:',getType('abc'))

    log.info('123 类型是:',getType(123))

    log.info('()=>{} 类型是:',getType(()=>{})))

isType

对比类型是否相同

用法

    import { log, isType } from 'wiz-utils'

    log.info('“abc” 类型是 String 吗?',isType('abc','String'))

    log.info('123 类型是 Number 吗?',isType(123,'Number'))

    log.info('()=>{} 类型是 Undefined 吗?',isType(()=>{},'Undefined')))

generateUUID

通过当前时间生成uuid

用法

    import { log, generateUUID } from 'wiz-utils'

    log.info('generateUUID:',generateUUID())