lodash APIs
- cloneDeep
- get
- isEqual
- isEmpty
- debounce
- merge
- uniq
- omit
- isString
- isArray
- pick
- sortBy
- groupBy
- flatten
- set
- find
- orderBy
- mapValues
- isObject
- last
- isNil
- isNumber
- range
- chunk
- throttle
- filter
- uniqBy
- difference
- pickBy
- noop
- capitalize
- uniqueId
- has
- isUndefined
- map
- camelCase
- isFunction
- kebabCase
- intersection
- random
- includes
- isPlainObject
- compact
- Dictionary
- findIndex
- keyBy
- forEach
- trim
- clamp
- identity
- remove
- keys
- isNull
- times
- startCase
- first
- values
- mapKeys
- sumBy
- max
- reduce
- some
- zip
- every
- memoize
- clone
- countBy
- concat
- snakeCase
- assign
- isBoolean
- uniqWith
- omitBy
- without
- minBy
- head
- maxBy
- min
- upperFirst
- escapeRegExp
- reverse
- sample
- shuffle
- defaults
- inRange
- flattenDeep
- take
- union
- sum
- mergeWith
- castArray
- replace
- flatMap
- reject
- zipObject
- template
- isNaN
- mean
- size
- findLast
- unset
- partition
- round
- fromPairs
- floor
- toPairs
- indexOf
- toString
- sampleSize
- differenceBy
- update
- chain
- startsWith
- xor
- pull
- DebouncedFunc
- defaultsDeep
- split
- findKey
- unescape
- partial
- toNumber
- invert
- each
- differenceWith
- endsWith
- slice
- isDate
- unionBy
- findLastIndex
- join
- isInteger
- delay
- isObjectLike
- padStart
- result
- isError
- extend
- cloneDeepWith
- upperCase
- trimStart
- constant
- matches
- lowerCase
- forIn
- lowerFirst
- once
- transform
- isMatch
- escape
- isEqualWith
- zipWith
- isRegExp
- entries
- sortedIndexBy
- dropWhile
- takeWhile
- isElement
- forEachRight
- ReplaceFunction
- TemplateExecutor
- keysIn
- IsEqualCustomizer
- isTypedArray
- cond
- stubTrue
- toUpper
- isMap
- isSet
- meanBy
- rangeRight
- repeat
- trimEnd
- now
- nth
- pullAt
- toPath
- eq
- lt
- lte
- gt
- gte
- pullAllBy
- pullAll
- toLower
- fill
- ceil
- flatMapDeep
- CloneDeepWithCustomizer
- negate
- takeRightWhile
- invoke
- tap
- intersectionWith
- truncate
- Collection
- bind
- curry
- partialRight
- sortedUniq
- sortedIndexOf
- Object
- drop
- _
Other Related APIs
lodash#isError TypeScript Examples
The following examples show how to use
lodash#isError.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: download.ts From generator-earth with MIT License | 6 votes |
download: IDownload = (url, params, type = 'get') => new Promise(async (resolve, reject) => {
try {
const res = await request[type](url, params)
// 请求出错,比如:状态码值404情况
if (isError(res)) {
throw new Error(`系统异常,请求失败\n错误信息:${res.message || ''}`)
}
// 如果返回的是json,则说明导出失败
if ('code' in res) {
throw new Error(`导出失败\n错误码值:${res.code}\n错误信息:${res.msg || ''}`)
}
// 获取文件名
const filename = res.headers.get('Content-Disposition').match(/filename=(.*)/) || []
const blob = await res.blob()
const fileUrl = URL.createObjectURL(blob)
resolve()
const a = document.createElement('a')
a.href = fileUrl
a.download = decodeURIComponent(filename[1] || '文件.zip').trim()
a.click()
window.URL.revokeObjectURL(fileUrl)
} catch (e) {
reject(e)
}
})
Example #2
Source File: showError.tsx From generator-earth with MIT License | 6 votes |
showError = (e?: Error | string): void => {
let msg;
if (isError(e)) {
msg = e.message
} else if (isString(e)) {
msg = e;
}
msg = msg || '系统异常'
Modal.error({
title: '错误提示',
content: <pre>{msg}</pre>,
})
}
Example #3
Source File: limiterGroup.ts From ts-di-starter with MIT License | 6 votes |
/**
* Handle rejection from limiter
*
* @param {Error|RateLimiterRes} error
* @returns {RateLimiterRes}
*/
static handleRejection(error): RateLimiterRes {
if (isError(error)) {
throw error;
}
return error;
}