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

js-base-methods

v1.0.8

Published

This is a package that contains many front-end common js methods.

Downloads

5

Readme

#js-base-methods

中文文档

1.Introduction

This is a npm package that contains a number of commonly used JavaScript methods.

2.Usage

1.Installation

  • Use the npm command to install:npm install --save js-base-methods
  • Or copy the contents of the base_methods.js file in the root directory into the js file you created yourself.

2.import

  • Import the methods you need using ES6:import {METHOD_NAME} from 'js-base-methods'

3.API

1.The getCookie method is used to get the value of the specified key in the cookie.

@param name {string}     // the key in cookie
@return {string}         // the value in cookie

2.The getUrlParam method is used to get the value of the specified parameter in the URL.

@param name {string}     // the parameter key in the URL
@return {string}         // the parameter value in the URL

3.The objIsEmpty method is used to determine if a js object is an empty object.

@param obj {object}      // the js object to be judged
@return {boolean}        // True is empty, false is not empty.

4.The formatTime method is used to format time.

@param time {string|number}       // timestamp in seconds
@param resType {string|number}    // The format of the returned string, which defaults to 1.
                                         // resType=1, the format is 2018-04-28
                                        // resType=2, the format is 2018-04-28 18:00:00
                                        // resType=3, the format is 18:00:00
@param connector {string}         // Year, month, day connector, default is '-'.
@return {string}                  // formatted time

5.The countDown method for countdown

@param callback {function}        // Callback function, which will be passed three string type parameters, respectively countdown hours, minutes, seconds.
@param endTime {string}           // countdown end time, such as: 2018/4/28 18:00:00
@param startTime {string}         // countdown start time, such as: 2018/5/1, the default is now.

6.The getMobileOperatingSystem method is used to get the current operating system type.

@return {string}         // operating system type, such as 'Windows Phone','Android','iOS' or 'unknow'