@motif/utils v0.4.9
utils : object
Kind: global namespace
- utils : object
- .scroll
- .compareVersions(firstVersion, secondVersion) ⇒ number
- .dateAdd(date, duration) ⇒ Date
- .dateDiff(leftDate, rightDate, unit) ⇒ Date
- .dateFormat(date, format) ⇒ string
- .dateISO(value) ⇒ Date
- .dateSubtract(date, duration) ⇒ Date
- .decodeSpecialChars(string) ⇒ string
- .getBool(value, defaultValue) ⇒ boolean
- .getJSON(data, defaultValue) ⇒ string
- .is(type, [value], [passLike]) ⇒ boolean
- .numberFormat(value) ⇒ string
- .paging(options) ⇒ Paging
- .parseJSON(jsonValue, defaultValue) ⇒ Object
- .passwordStrength(value) ⇒ number
- .queryString(value) ⇒ string
- .split(string, delimiter, options) ⇒ string
- .stripSlashes(string) ⇒ string
- .timestamp() ⇒ Date
- .truncate(string, maxLength, options) ⇒ string
- .uuid() ⇒ string
- .queue(options) ⇒ Queue
- .timeout(component, key, callback, milliseconds) ⇒ Timeout
- .getTimeout(component) ⇒ Timeout
- .call(component, key, callback, milliseconds, [options]) ⇒ TimeoutInstance
- .once(component, key, callback, milliseconds, [options]) ⇒ TimeoutInstance
- .interval(component, key, callback, milliseconds, [options]) ⇒ TimeoutInstance
- .has(component, key) ⇒ boolean
- .clear(component, [keys]) ⇒ boolean
- .sleep(milliseconds)
- .ui(ref) ⇒ UIView
- .getElement(ref) ⇒ Element
- .getRect(ref) ⇒ UIRect
- .getRectEdge(ref) ⇒ UIRectEdge
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 |
- .timeout(component, key, callback, milliseconds) ⇒ Timeout
- .getTimeout(component) ⇒ Timeout
- .call(component, key, callback, milliseconds, [options]) ⇒ TimeoutInstance
- .once(component, key, callback, milliseconds, [options]) ⇒ TimeoutInstance
- .interval(component, key, callback, milliseconds, [options]) ⇒ TimeoutInstance
- .has(component, key) ⇒ boolean
- .clear(component, [keys]) ⇒ boolean
- .sleep(milliseconds)
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 |
- .ui(ref) ⇒ UIView
- .getElement(ref) ⇒ Element
- .getRect(ref) ⇒ UIRect
- .getRectEdge(ref) ⇒ UIRectEdge
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
- .getType() ⇒ TimeoutInstanceType
- .execute()
- .call()
- .clear()
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>
- .getInstances(keys) ⇒ Array.<TimeoutInstance>
- .has(key) ⇒ boolean
- .get(key) ⇒ TimeoutInstance
- .set(key, instance)
- .expire(key)
- .delete(key)
- .clear([keys]) ⇒ boolean
- .call(key, callback, milliseconds, [options]) ⇒ TimeoutInstance
- .once(key, callback, milliseconds, [options]) ⇒ TimeoutInstance
- .interval(key, callback, milliseconds, [options]) ⇒ TimeoutInstance
- .sleep(milliseconds)
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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago