JSPM

  • Created
  • Published
  • Downloads 1202
  • Score
    100M100P100Q120852F
  • License MIT

package myrmidon provides a list of common utilities for comfortable work with js projects.

Package Exports

  • myrmidon

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (myrmidon) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

myrmidon

package myrmidon provides a list of common utilities for comfortable work with js projects.

Version Bundle size Downloads

CodeFactor SonarCloud Codacy Total alerts Language grade Scrutinizer

Dependencies Vulnerabilities Build Status Coverage Status

Commit activity License

Table of Contents

Requirements

To use library you need to have node and npm installed in your machine:

  • node 6.0+
  • npm 3.0+

Installation

To install the library, run the following command

  npm i --save myrmidon

Usage

Read full docs

checkType

helps to indicate type of any value

  • isString - determines whether the value is string
  • isClass - determines whether the value is class
  • isFunction - determines whether the value is function
  • isObject - determines whether the value is an object
  • isArray - determines whether the value is array
  • isPromise - determines whether the value is promise
  • isValue - determines whether the value is set
  • isNumber - determines whether the value is Number
  • isBoolean - determines whether the value is Boolean
  • isStream - determines whether the value is Stream
  • isGetter - determines whether the value is function getter
  • isRegexp - determines whether the value is regualr expression

array

helps to work with js arrays

  • toArray - transforms any value to Array
  • uniqueFilter - generates filter function, that leaves only unique items
  • uniqueIdFilter - filter function, that leaves only unique items with same id property
  • uniqueIdenticFilter - filter function, that leaves only identicly unique items (same by ===)
  • existanceFilter - filter function, that leaves only exited values
  • passFilter - filter function, that leaves all items
  • flatten - flattens array
  • isUnique - checks are all items of array unique
  • last - get last element of an array

object

  • cleanUndefined - cleans object from undefined fields recursievly
  • clone - create deep clone of object
  • isEmpty - determines whether the object or array is empty

benchmark

helps to benchmark execution time

custom

  • retry - Retrying function calls on errors
  • getProp - Get nested property of object
  • fill - Fills string template with specified data
  • searchFor - Search all occurrences of pattern in text

Contribute

Make the changes to the code and tests. Then commit to your branch. Be sure to follow the commit message conventions.

Commit message summaries must follow this basic format:

  Tag: Message (fixes #1234)

The Tag is one of the following:

  • Fix - for a bug fix.
  • Update - for a backwards-compatible enhancement.
  • Breaking - for a backwards-incompatible enhancement.
  • Docs - changes to documentation only.
  • Build - changes to build process only.
  • New - implemented a new feature.
  • Upgrade - for a dependency upgrade.
  • Chore - for tests, refactor, style, etc.

The message summary should be a one-sentence description of the change. The issue number should be mentioned at the end.