deno.land / x / fuse@v6.4.1 / src / helpers / types.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
export function isArray(value) { return !Array.isArray ? getTag(value) === '[object Array]' : Array.isArray(value)}
// Adapted from: https://github.com/lodash/lodash/blob/master/.internal/baseToString.jsconst INFINITY = 1 / 0export function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value } let result = value + '' return result == '0' && 1 / value == -INFINITY ? '-0' : result}
export function toString(value) { return value == null ? '' : baseToString(value)}
export function isString(value) { return typeof value === 'string'}
export function isNumber(value) { return typeof value === 'number'}
// Adapted from: https://github.com/lodash/lodash/blob/master/isBoolean.jsexport function isBoolean(value) { return ( value === true || value === false || (isObjectLike(value) && getTag(value) == '[object Boolean]') )}
export function isObject(value) { return typeof value === 'object'}
// Checks if `value` is object-like.export function isObjectLike(value) { return isObject(value) && value !== null}
export function isDefined(value) { return value !== undefined && value !== null}
export function isBlank(value) { return !value.trim().length}
// Gets the `toStringTag` of `value`.// Adapted from: https://github.com/lodash/lodash/blob/master/.internal/getTag.jsfunction getTag(value) { return value == null ? value === undefined ? '[object Undefined]' : '[object Null]' : Object.prototype.toString.call(value)}
fuse

Version Info

Tagged at
3 years ago