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

vim_utility

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vim_utility

helper export functionfor javascript

latest
Source
npmnpm
Version
1.0.11
Version published
Maintainers
1
Created
Source

javascript-utility

Build Status Coverage Status npm GitHub stars

Install


npm install --save-dev vim_utility

usage

import {s_random} from "vim_utility"
s_random(7);

doc

scss

px2rem

click to see code

// import px2rem.js in your bootstrap js
import {px2rem} from "vim_utility/utility"



// Dynamically change the html font-size when window's size changed
px2rem();
@import '~vim_utility/src/scss/px2rem.scss';
$designWidth : 750px; /*Design draft width*/

.example{
  height: px2rem(200px);
  border: solid 1px black;
  	font-size: 12px ;
  	[data-dpr="2"] &{
  		font-size: 24px;
  	}
  	[data-dpr="3"] &{
  		font-size: 36px;
  	}
}
 

getCookie

// assuming there is (yourKey => yourValue) in the cookie
getCookie(yourKey); // return yourValue

removeCookie

removeCookie(yourKey);

setCookie

setCookie(key, value, days);

dom

addClass

addClass(ele, cls); /*ele instance of Node, cls is string*/

closestNode

closestNode(el, selector); /*Similar to the jquery closestNode method*/

css

css(ele, prop); /*get css attribute value*/

elementFromPoint

elementFromPoint(e); // e is mouse event
// return Node

getCaretPosition

getCaretPosition (el); // return number;

getMaxZIndex

getMaxZIndex(ele = undefined); // if ele === undefined , return max z-index value in the document

getScrollLeft

getScrollLeft();

getScrollTop

getScrollTop();

hasClass

hasClass(ele, cls);

nextNode

nextNode(el, selector);

offset

offset(ele); // get distance away from window
/* @return
* {
    left: x,  
     top: y
   }
* */

parentNode

parentNode(el, selector, root=undefined);

prevNode

prevNode(el, selector);

removeClass

removeClass(ele, cls);

scrollTo

scrollTo(to, duration); //  scroll to given place during given time

setScrollTop

setScrollTop(value); // it exec window.scrollTo();

toggleClass

toggleClass(ele, cls);

toDataUri

toDataUri(url, (d) => {console.log(d);}); // transfer image png/jpg to base64

function

throttle

throttle(delay, callback, debounceMode = false, immediate = false);

debounce

let wrap = debounce(/*callback*/ (e) => {console.log(e);}, /*delay*/ 500); // return wrapper function;
window.addEventListener('resize', (e) => {wrap(e)});

keycode

keyCode

keyCode(name); // return keyCode Number;

object

deepClone

deepClone(obj); // return any;

random

n_random

n_random(min, max, n = 1);

s_random

s_random(7); // return string it's length is 7

regexp

getExplore

getExplore(); // get explore type and version

getOS

getOS();

getUrlParam

getUrlParam(url); // return Map;

isChinaIDCard

isChinaIDCard(str); // return boolean

isEmail

isEmail(str); // return boolean

isPhone

isPhone(str); // return boolean, validator chinese phone number

isUrl

isUrl(url); // return boolean

time

getTimeStamp

getTimeStamp({ cal = new Date(), d = 0, h = 0, m = 0 , s = 0 } = {}); // return number(seconds)

Keywords

helper

FAQs

Package last updated on 11 Mar 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