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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@motif/utils

v0.4.9

Published

Motif JavaScript Utility Library

Readme

utils : object

Kind: global namespace

utils.scroll

Kind: static property of utils

utils.scroll.to(options)

Kind: static method of scroll

| Param | Type | | --- | --- | | options | ScrollToOptions |

utils.scroll.top()

Kind: static method of scroll

utils.compareVersions(firstVersion, secondVersion) ⇒ number

Kind: static method of utils

| Param | Type | Description | | --- | --- | --- | | firstVersion | string | 원래 버전 | | secondVersion | string | 비교할 버전 |

utils.dateAdd(date, duration) ⇒ Date

Kind: static method of utils

| Param | Type | Description | | --- | --- | --- | | date | Date | number | 원래 날짜 | | duration | utils.Duration | 증가시킬 시간 |

utils.dateDiff(leftDate, rightDate, unit) ⇒ Date

Kind: static method of utils

| Param | Type | Description | | --- | --- | --- | | leftDate | Date | number | string | 원래 날짜 | | rightDate | Date | number | string | 비교할 날짜 | | unit | utils.DateUnit | 비교 단위 |

utils.dateFormat(date, format) ⇒ string

Kind: static method of utils

| Param | Type | Description | | --- | --- | --- | | date | Date | number | string | 원래 날짜 | | format | string | 변환할 형식 |

Example

// Represent 11 February 2014 in middle-endian format:
var result = utils.dateFormat(new Date(2014, 1, 11), 'MM/dd/yyyy')
//=> '02/11/2014'

Example

// Represent 2 July 2014 in Esperanto:
import { eoLocale } from 'date-fns/locale/eo'
var result = utils.dateForma(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
  locale: eoLocale
})
//=> '2-a de julio 2014'

Example

// Escape string by single quote characters:
var result = utils.dateForma(new Date(2014, 6, 2, 15), "h 'o''clock'")
//=> "3 o'clock"

utils.dateISO(value) ⇒ Date

Kind: static method of utils

| Param | Type | Description | | --- | --- | --- | | value | Date | Number | String | 시간 데이타 |

utils.dateSubtract(date, duration) ⇒ Date

Kind: static method of utils

| Param | Type | Description | | --- | --- | --- | | date | Date | number | 원래 날짜 | | duration | utils.Duration | 감소시킬 시간 |

utils.decodeSpecialChars(string) ⇒ string

Kind: static method of utils

| Param | Type | Description | | --- | --- | --- | | string | string | 변환할 문자 |

utils.getBool(value, defaultValue) ⇒ boolean

Kind: static method of utils

| Param | Type | Default | Description | | --- | --- | --- | --- | | value | any | | 임의 값 | | defaultValue | boolean | false | 기본값 정의 |

utils.getJSON(data, defaultValue) ⇒ string

Kind: static method of utils

| Param | Type | Default | Description | | --- | --- | --- | --- | | data | Object | | JSON 객체 | | defaultValue | string | "{}" | |

utils.is(type, [value], [passLike]) ⇒ boolean

Kind: static method of utils

| Param | Type | Description | | --- | --- | --- | | type | utils.Types | 체크할 타입 | | [value] | any | | | [passLike] | boolean | 유사타입 허용 |

utils.numberFormat(value) ⇒ string

Kind: static method of utils

| Param | Type | Description | | --- | --- | --- | | value | number | string | |

utils.paging(options) ⇒ Paging

Kind: static method of utils

| Param | Type | | --- | --- | | options | PagingParameters |

utils.parseJSON(jsonValue, defaultValue) ⇒ Object

Kind: static method of utils

| Param | Type | Default | | --- | --- | --- | | jsonValue | string | | | defaultValue | Object | {} |

utils.passwordStrength(value) ⇒ number

Kind: static method of utils

| Param | Type | Description | | --- | --- | --- | | value | number | string | |

utils.queryString(value) ⇒ string

Kind: static method of utils

| Param | Type | Description | | --- | --- | --- | | value | object | |

utils.split(string, delimiter, options) ⇒ string

Kind: static method of utils

| Param | Type | Default | Description | | --- | --- | --- | --- | | string | Array.<string> | string | | 문자열 | | delimiter | string | "," | 구분자 | | options | SplitOptions | | 추가 옵션 |

utils.stripSlashes(string) ⇒ string

Kind: static method of utils

| Param | Type | Description | | --- | --- | --- | | string | string | 문자열 |

utils.timestamp() ⇒ Date

Kind: static method of utils

utils.truncate(string, maxLength, options) ⇒ string

Kind: static method of utils

| Param | Type | Description | | --- | --- | --- | | string | string | 문자열 | | maxLength | number | 최대 길이 | | options | TruncateOptions | 추가 옵션 |

utils.uuid() ⇒ string

Kind: static method of utils

utils.queue(options) ⇒ Queue

Kind: static method of utils

| Param | Type | | --- | --- | | options | QueueOptions |

utils.timeout(component, key, callback, milliseconds) ⇒ Timeout

Kind: static method of utils

| Param | Type | | --- | --- | | component | any | | key | string | | callback | function | | milliseconds | number |

utils.timeout.getTimeout(component) ⇒ Timeout

Kind: static method of timeout

| Param | Type | | --- | --- | | component | any |

utils.timeout.call(component, key, callback, milliseconds, [options]) ⇒ TimeoutInstance

Kind: static method of timeout

| Param | Type | | --- | --- | | component | any | | key | string | | callback | function | | milliseconds | number | | [options] | TimeoutOptions |

utils.timeout.once(component, key, callback, milliseconds, [options]) ⇒ TimeoutInstance

Kind: static method of timeout

| Param | Type | | --- | --- | | component | any | | key | string | | callback | function | | milliseconds | number | | [options] | TimeoutOptions |

utils.timeout.interval(component, key, callback, milliseconds, [options]) ⇒ TimeoutInstance

Kind: static method of timeout

| Param | Type | | --- | --- | | component | any | | key | string | | callback | function | | milliseconds | number | | [options] | TimeoutOptions |

utils.timeout.has(component, key) ⇒ boolean

Kind: static method of timeout

| Param | Type | | --- | --- | | component | any | | key | string |

utils.timeout.clear(component, [keys]) ⇒ boolean

Kind: static method of timeout

| Param | Type | | --- | --- | | component | any | | [keys] | Array.<string> |

utils.timeout.sleep(milliseconds)

Kind: static method of timeout

| Param | Type | | --- | --- | | milliseconds | number |

utils.ui(ref) ⇒ UIView

Kind: static method of utils

| Param | Type | | --- | --- | | ref | any |

utils.ui.getElement(ref) ⇒ Element

Kind: static method of ui

| Param | Type | | --- | --- | | ref | any |

utils.ui.getRect(ref) ⇒ UIRect

Kind: static method of ui

| Param | Type | | --- | --- | | ref | any |

utils.ui.getRectEdge(ref) ⇒ UIRectEdge

Kind: static method of ui

| Param | Type | | --- | --- | | ref | any |

Duration : enum

Kind: global enum

DateUnit : enum

Kind: global enum

Types : enum

Kind: global enum

TimeoutInstanceType : enum

Kind: global enum

Paging : Object

Kind: global typedef
Properties

| Name | Type | | --- | --- | | page | number | | size | number |

PagingParameters : Object

Kind: global typedef
Properties

| Name | Type | Default | | --- | --- | --- | | page | number | 1 | | size | number | 20 |

SplitOptions : Object

Kind: global typedef
Properties

| Name | Type | Default | Description | | --- | --- | --- | --- | | maxLength | number | | | | clean | boolean | true | 배열인 경우 있는 값만 정리 | | defaultValue | Array.<string> | [ | 예외 케이스가 발생하는 경우 기본 값 출력 |

TruncateOptions : Object

Kind: global typedef
Properties

| Name | Type | Default | | --- | --- | --- | | suffix | string | "..." |

QueueOptions : Object

Kind: global typedef
Properties

| Name | Type | Default | | --- | --- | --- | | onTask | function | | | jobs | Array.<any> | [ | | interval | number | 0 | | autoStart | boolean | false |

Queue

Kind: global typedef
Properties

| Name | Type | | --- | --- | | length | number |

queue.add()

Kind: instance method of Queue

queue.remove(id)

Kind: instance method of Queue

| Param | Type | | --- | --- | | id | string |

queue.reverse()

Kind: instance method of Queue

queue.start()

Kind: instance method of Queue

queue.stop()

Kind: instance method of Queue

ScrollToOptions : Object

Kind: global typedef
Properties

| Name | Type | Default | | --- | --- | --- | | context | any | | | type | string | "timeout" |

TimeoutOptions : Object

Kind: global typedef
Properties

| Name | Type | Default | | --- | --- | --- | | context | Context | | | type | string | "timeout" |

TimeoutInstance

Kind: global typedef
Properties

| Name | Type | | --- | --- | | instance | NodeJS.Timeout | | callCount | number | | type | string |

timeoutInstance.getInstance() ⇒ NodeJS.Timeout | null

Kind: instance method of TimeoutInstance

timeoutInstance.getType() ⇒ TimeoutInstanceType

Kind: instance method of TimeoutInstance

timeoutInstance.execute()

Kind: instance method of TimeoutInstance

timeoutInstance.call()

Kind: instance method of TimeoutInstance

timeoutInstance.clear()

Kind: instance method of TimeoutInstance

Timeout

Kind: global typedef
Properties

| Name | Type | | --- | --- | | keys | Array.<string> |

timeout.getKeys() ⇒ Array.<string>

Kind: instance method of Timeout

timeout.getInstances(keys) ⇒ Array.<TimeoutInstance>

Kind: instance method of Timeout

| Param | Type | | --- | --- | | keys | Array.<string> |

timeout.has(key) ⇒ boolean

Kind: instance method of Timeout

| Param | Type | | --- | --- | | key | string |

timeout.get(key) ⇒ TimeoutInstance

Kind: instance method of Timeout

| Param | Type | | --- | --- | | key | string |

timeout.set(key, instance)

Kind: instance method of Timeout

| Param | Type | | --- | --- | | key | string | | instance | TimeoutInstance |

timeout.expire(key)

Kind: instance method of Timeout

| Param | Type | | --- | --- | | key | string |

timeout.delete(key)

Kind: instance method of Timeout

| Param | Type | | --- | --- | | key | string |

timeout.clear([keys]) ⇒ boolean

Kind: instance method of Timeout

| Param | Type | | --- | --- | | [keys] | Array.<string> |

timeout.call(key, callback, milliseconds, [options]) ⇒ TimeoutInstance

Kind: instance method of Timeout

| Param | Type | | --- | --- | | key | string | | callback | function | | milliseconds | number | | [options] | TimeoutOptions |

timeout.once(key, callback, milliseconds, [options]) ⇒ TimeoutInstance

Kind: instance method of Timeout

| Param | Type | | --- | --- | | key | string | | callback | function | | milliseconds | number | | [options] | TimeoutOptions |

timeout.interval(key, callback, milliseconds, [options]) ⇒ TimeoutInstance

Kind: instance method of Timeout

| Param | Type | | --- | --- | | key | string | | callback | function | | milliseconds | number | | [options] | TimeoutOptions |

timeout.sleep(milliseconds)

Kind: instance method of Timeout

| Param | Type | | --- | --- | | milliseconds | number |

UIRect : Object

Kind: global typedef
Properties

| Name | Type | | --- | --- | | x | number | | y | number | | width | number | | height | number |

UIRectEdge : Object

Kind: global typedef
Properties

| Name | Type | | --- | --- | | top | number | | right | number | | bottom | number | | left | number |

UIView : Object

Kind: global typedef