New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

cuj

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cuj

Common Use Js

latest
Source
npmnpm
Version
1.0.16
Version published
Maintainers
1
Created
Source

CUJs

基于ES6编写的常用JS函数

CSS 类

  • hasClass(class)

检查当前的元素是否含有某个特定的类,如果有,则返回true。

  • addClass(class)

为每个匹配的元素添加指定的类名,一个或多个要删除的CSS类名,请用空格分开。

  • removeClass(class)

从所有匹配的元素中删除全部或者指定的类,一个或多个要删除的CSS类名,请用空格分开。

  • toggleClass(class)

如果存在(不存在)就删除(添加)一个类。

效果

  • show()

显示隐藏的匹配元素。

  • hide()

隐藏显示的元素。

String

  • getQueryString()
// abc.com?test=123
CUJs.String.getQueryString('test')  // 123
  • limitText()
let abc = 'abc12345678'
CUJs.String.getQueryString(abc,7)  // abc1234...

Array

  • unique(arr)
let arr = [1,3,4,5,8,5,3,9]
CUJs.Array.unique(arr)  // [1,3,4,5,8,9]

Date

  • format(fmt,date)
let _date = new Date();
CUJs.Date.format('yyyy-MM-dd hh:mm:ss',_date)  // 2018-05-30 10:05:54
CUJs.Date.format('yyyy-MM-dd',_date)  // 2018-05-30
CUJs.Date.format('M月d日 hh:mm:ss',_date);  // 5月30日 10:05:54
CUJs.Date.format('yyyy/MM/dd hh:mm',_date);  // 2018/05/30 10:05

Function

  • CountDown(el,options)
var app = document.getElementById('app');
var count = new CUJs.CountDown(app,{
    countDownSeconds: 7,       //倒计时间设置
    doubleDigit: true,          //'7'秒显示为'07'
    secondsOnly: false,         //是否只显示秒
    callback = () => {          //倒计时完回调函数
        return false;
    }
})

Keywords

es6

FAQs

Package last updated on 30 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts