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

starke

v1.0.75

Published

starke means powerful

Downloads

22

Readme

starke

starke means powerful

wonderful utils for javascript developer

模块简介

|名称|备注| |:-:|:-:| |CircularFormat|环形对象格式化| |Schedule|定时任务的载体| |ScheduleQueue|按顺序执行定时任务的队列| |StarkeLogger|在控制台打印多彩的日志| |Determination|Util 算法|

Example of Determination

1. isEmpty [Function]

// isEmpty support strict or loose non-empty judgment of objects
// It can effectively avoid the null pointer problem in front-end development.
const obj = {
    name: '',
    auhtor: '',
    hobby: []
}
// false
const empty = isEmpty(obj)
// ture
const empty = isEmpty(obj, true)

2. clearObject [Function]

// Sometimes we want to keep the keys of the object while emptying the cache
let cache = {
    name: 'starke',
    auhtor: '4everlynn',
    hobby: ['coding', 'music']
}
// after call this obj will be empty
// like {name: '', author: '', hobby: []} 
// which could be judged as true by isEmpty
clearObject(obj)

3. equals [Function]

// Sometimes we want to determine whether two objects are equal in attribute values.
// this function will be usefull
let user = {
    name: '4everlynn',
    hobby: ['coding', 'music']
}
let cache = {
    name: '4everlynn',
    hobby: ['coding', 'music']
}
// false
const isEqual = user === cache
// true
const starkeEq = equals(user, cache)
// It can even handle the equality of ring objects.
// And starke create this function by hash, which is very stable

4. hash [Function]

// Get the hash code of the string
const string = 'Hello Starke'
const code = hash(string)

5. filter [Function]

// Filter array by condition
const users = [{
    user: '4everlynn',
    age: 20
}, {
    user: 'Starke',
    age: 1
}, {
    user: 'Lynn',
    age: 18
}]
/** result 
 [{
    user: '4everlynn',
    age: 20
}, {
    user: 'Lynn',
    age: 18
}]
 */
const target = filter(users, item => {
    return item.age < 20
})

6. group [Function]

// group array by condition
const users = [{
    user: '4everlynn',
    age: 20,
    role: 'admin'
}, {
    user: 'Starke',
    age: 1,
    role: 'admin'
}, {
    user: 'Lynn',
    age: 18,
    role: 'user'
}]
// result:
// [ [ { user: '4everlynn', age: 20, role: 'admin' },
//         { user: 'Starke', age: 1, role: 'admin' } ],
//       [ { user: 'Lynn', age: 18, role: 'user' } ] ]
const target = group(users, item => {
    // group by 'role'
    return item.role
})

7. hashColor [Function]

const category = 'Operate'
// Generate a stable RGB color based on the string
// rgb(232.2421875, 160, 244)
const color = hashColor(category)
// No matter how many times it runs, the result is the same.