Socket
Book a DemoInstallSign in
Socket

fe-utils

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fe-utils

collect all kinds of utility functions that are often used by us.

1.1.6
latest
tag/1.1.6
Source
npmnpm
Version published
Weekly downloads
13
30%
Maintainers
1
Weekly downloads
 
Created
Source

fe-utils

collect all kinds of utility functions that are often used by us.

Installation

In a browser:

<script src="fe-utils.js"></script>

Using npm:

$ npm i -g npm
$ npm i --save fe-utils

Usage:

// Load method categories.
var cookie = require('fe-utils/cookie')
var date = require('fe-utils/date')
...

allMethods:

  • NumberToChinese

    NumberToChinese(12345) // '一万二千三百四十五'
    NumberToChinese(12345, true) // '壹万贰仟叁佰肆十伍'
    
  • cookie

    setCookie(name, domain, domain, expiredays)
    getCookie(name)
    delCookie(name, domain)
    
  • date

    dateFormat() // dateFormat(new Date(), 'YYYY年MM月DD日 hh:mm:ss')
    
  • detectedInfos

    isAndroid / isIOS / isWindowPhone / isWX / isWeibo / isMobile / isPC
    
  • preventViewScroll

    https://github.com/lzwaiwai/preventViewScroll

  • urlQuery

    const url = 'http://live.tinfinite.com:8080/path/chat-studio.html?liveshowId=592e4e2bf84e6e26c1cf97dd&group=live#123'
    queryOne
        // queryOne('liveshowId', url) -> '592e4e2bf84e6e26c1cf97dd'
    queryAll
        // queryAll(url) -> { liveshowId: '592e4e2bf84e6e26c1cf97dd', group: 'live' }
    update
        // update({ group: 'voice', referer: 'list' }, url) ->
        // {
                query: {
                    liveshowId: '592e4e2bf84e6e26c1cf97dd',
                    group: 'voice',
                    referer: 'list'
                },
                url: 'http://live.tinfinite.com:8080/path/chat-studio.html?liveshowId=592e4e2bf84e6e26c1cf97dd&group=voice&referer=list#123'
            }
    del
        // del('liveshowId', url) ->
        // {
                query: {
                    group: 'live'
                },
                url: 'http://live.tinfinite.com:8080/path/chat-studio.html?group=live#123'
            }
    
        // del(['liveshowId', 'group'], url) ->
        // {
                query: {},
                search: 'http://live.tinfinite.com:8080/path/chat-studio.html#123'
            }
    
  • toRoman

    toRoman(25) // 'XXV'
    
  • getVersionOfIOS

    getVersionOfIOS() // '10.3'
    
  • relProtocol

    relProtocol('http://xxx.com') // '//xxx.com'
    
  • logger

  • mediaError

    mediaError(video / audio, (code, msg) => { ... })  // for error-listener-callback of audio and video
    
  • loadJs

     loadJs(url, callback)
    

Thank to A-Dan, shaoyishou, Div

Keywords

fe

FAQs

Package last updated on 10 Aug 2017

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.