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

dark-fns

v1.1.1

Published

My function library without operation on dom

Downloads

6

Readme

description

My function library without operation on dom

use

var darkFns = require('dark-fns')
console.log(darkFns)
// {
//   assert,
//   fns,
//   object,
//   array,
//   ...
// }

API

assert methods

function isFn(target: any): boolean;
function isArray(target: any): boolean;
function isString(target: any): boolean;
function isUnDef(target: any): boolean;
function isNull(target: any): boolean;
function isNumber(target: any): boolean;
function isObj(target: any): boolean;
function isStrictObj(target: any): boolean;
function isEmptyObj(target: any): boolean;
function isEmptyArray(target: any): boolean;
function isEmptyString(target: any): boolean;
function isEmpty(target: any): boolean;
function isZero(target: any): boolean;
function isTrue(target: any): boolean;
function isFalse(target: any): boolean;
function isFalsy(target: any): boolean;
function isInstanceOf(target: any, Class: any): boolean;

object methods

/**
 * get strict object's value by path
 * @param { object } obj strict object (json-like)
 * @param { string } path the key path like `a.b.c`, if the path is an empty string, return obj itself
 * @param { * } defaultVal if the path exists and the value is undefined, will return defaultVal
 * @return { * } return value/defaultVal, but if the path is not exists, return null
 * 
 */
function getValByKeyPath(obj: any, path: string, defaultVal: any): any;
/**
 * set strict object's value by path
 * @param { object } obj strict object (json-like)
 * @param { string } path the key path like `a.b.c`
 * @param { * } defaultVal if the path exists and the value is undefined, will return defaultVal
 * @return { void | null } return null if the partial path (not whole path) is not found
 */
function setValByKeyPath(obj: any, val: any, path: string): boolean;
/**
 * mixin strict object
 * if isConcatFn is true, concat function
 * if isConcatArr is true, concat array
 * @param { object } target 
 * @param { object } source 
 * @param { object } opts { isConcatFn, isConcatArr }
 * @return return the target
 */
function mixin (target: object, source: object, opts: object = {}): object;

fns methods

/**
 * concat functions
 * @param { ...function } ...fns variable length parameters
 * @return { function } return a new function formed by the combination of multiple functions
 * @example
 * function a () {
 *  console.log(1)
 * }
 * function b () {
 *  console.log(2)
 * }
 * var fn = concatFn(a, b)
 * fn() // => 1, 2
 */
function concatFn (...fns: Function[]): Function
/**
 * function currying
 * @example
 * function add (a, b) {
 *  return a + b
 * }
 * var fn = curry(1)
 * fn(2) // => 3
 * @param { function } fn the function to be fixed paramters
 * @param { ...* } ...args variable length parameters
 * @return { function } return a new function with fixed parameters
 */
function curry (fn: Function): Function

More Information