Hefty

Results 107 issues of Hefty

本文为读 lodash 源码的第三百四十四篇,后续文章会更新到这个仓库中,欢迎 star:[pocket-lodash](https://github.com/yeyuqiudeng/pocket-lodash) gitbook也会同步仓库的更新,gitbook地址:[pocket-lodash](https://www.gitbook.com/book/yeyuqiudeng/pocket-lodash/details) ## 依赖 ```javascript import isError from './isError.js' ``` [《lodash源码分析之isError》](https://github.com/yeyuqiudeng/pocket-lodash/issues/223) ## 源码分析 `attempt` 会调用传入的函数 `func` ,并将参数传入,最终会返回函数的调用结果,或者返回一个错误对象。 源码如下: ```javascript function attempt(func, ...args) { try { return func(...args)...

系列文章
api

本文为读 lodash 源码的第三百四十三篇,后续文章会更新到这个仓库中,欢迎 star:[pocket-lodash](https://github.com/yeyuqiudeng/pocket-lodash) gitbook也会同步仓库的更新,gitbook地址:[pocket-lodash](https://www.gitbook.com/book/yeyuqiudeng/pocket-lodash/details) ## 依赖 ```javascript import words from './words.js' import toString from './toString.js' ``` [《lodash源码分析之words》](https://github.com/yeyuqiudeng/pocket-lodash/issues/314) [《lodash源码分析之toString》](https://github.com/yeyuqiudeng/pocket-lodash/issues/252) ## 源码分析 `upperCase` 用来将字符串转换成单词,每个单词用空格隔开,并且每个单词都转换成大写。 如将 `foo-Bar` 转换成 `FOO BAR` 。 源码如下:...

系列文章
api

本文为读 lodash 源码的第三百三十四篇,后续文章会更新到这个仓库中,欢迎 star:[pocket-lodash](https://github.com/yeyuqiudeng/pocket-lodash) gitbook也会同步仓库的更新,gitbook地址:[pocket-lodash](https://www.gitbook.com/book/yeyuqiudeng/pocket-lodash/details) ## 依赖 ```javascript import words from './words.js' import toString from './toString.js' ``` [《lodash源码分析之words》](https://github.com/yeyuqiudeng/pocket-lodash/issues/314) [《lodash源码分析之toString》](https://github.com/yeyuqiudeng/pocket-lodash/issues/252) ## 源码分析 `startCase` 用来将字符串转换成单词,每个单词用空格隔开,并且每个单词的首字母大写。 如将 `foo-Bar` 转换成 `Foo Bar` 。 源码如下:...

系列文章
api

本文为读 lodash 源码的第三百四十二篇,后续文章会更新到这个仓库中,欢迎 star:[pocket-lodash](https://github.com/yeyuqiudeng/pocket-lodash) gitbook也会同步仓库的更新,gitbook地址:[pocket-lodash](https://www.gitbook.com/book/yeyuqiudeng/pocket-lodash/details) ## 源码分析 `unescape` 的作用和 `escape` 刚好相反,是将编码转换成 `HTML` 实体。 源码如下: ```javascript const htmlUnescapes = { '&': '&', '<': '', '"': '"', ''': "'" } const reEscapedHtml...

系列文章
api

本文为读 lodash 源码的第三百四十一篇,后续文章会更新到这个仓库中,欢迎 star:[pocket-lodash](https://github.com/yeyuqiudeng/pocket-lodash) gitbook也会同步仓库的更新,gitbook地址:[pocket-lodash](https://www.gitbook.com/book/yeyuqiudeng/pocket-lodash/details) ## 依赖 ```javascript import baseToString from './.internal/baseToString.js' import castSlice from './.internal/castSlice.js' import hasUnicode from './.internal/hasUnicode.js' import isObject from './isObject.js' import isRegExp from './isRegExp.js' import stringSize...

系列文章
api

本文为读 lodash 源码的第三百四十篇,后续文章会更新到这个仓库中,欢迎 star:[pocket-lodash](https://github.com/yeyuqiudeng/pocket-lodash) gitbook也会同步仓库的更新,gitbook地址:[pocket-lodash](https://www.gitbook.com/book/yeyuqiudeng/pocket-lodash/details) ## 依赖 ```javascript import castSlice from './.internal/castSlice.js' import charsEndIndex from './.internal/charsEndIndex.js' import stringToArray from './.internal/stringToArray.js' ``` [《lodash源码分析之castSlice》](https://github.com/yeyuqiudeng/pocket-lodash/issues/310) [《lodash源码分析之charsStartIndex》](https://github.com/yeyuqiudeng/pocket-lodash/issues/338) [《lodash源码分析之stringToArray》](https://github.com/yeyuqiudeng/pocket-lodash/issues/245) ## 源码分析 `trimStart` 是将字符串 `string` 前面指定的字符...

系列文章
api

本文为读 lodash 源码的第三百三十九篇,后续文章会更新到这个仓库中,欢迎 star:[pocket-lodash](https://github.com/yeyuqiudeng/pocket-lodash) gitbook也会同步仓库的更新,gitbook地址:[pocket-lodash](https://www.gitbook.com/book/yeyuqiudeng/pocket-lodash/details) ## 依赖 ```javascript import castSlice from './.internal/castSlice.js' import charsEndIndex from './.internal/charsEndIndex.js' import stringToArray from './.internal/stringToArray.js' ``` [《lodash源码分析之castSlice》](https://github.com/yeyuqiudeng/pocket-lodash/issues/310) [《lodash源码分析之charsEndIndex》](https://github.com/yeyuqiudeng/pocket-lodash/issues/337) [《lodash源码分析之stringToArray》](https://github.com/yeyuqiudeng/pocket-lodash/issues/245) ## 源码分析 `trimEnd` 是将字符串 `string` 后面指定的字符...

系列文章
api

本文为读 lodash 源码的第三百三十八篇,后续文章会更新到这个仓库中,欢迎 star:[pocket-lodash](https://github.com/yeyuqiudeng/pocket-lodash) gitbook也会同步仓库的更新,gitbook地址:[pocket-lodash](https://www.gitbook.com/book/yeyuqiudeng/pocket-lodash/details) ## 依赖 ```javascript import castSlice from './.internal/castSlice.js' import charsEndIndex from './.internal/charsEndIndex.js' import charsStartIndex from './.internal/charsStartIndex.js' import stringToArray from './.internal/stringToArray.js' ``` [《lodash源码分析之castSlice》](https://github.com/yeyuqiudeng/pocket-lodash/issues/310) [《lodash源码分析之charsEndIndex》](https://github.com/yeyuqiudeng/pocket-lodash/issues/337) [《lodash源码分析之charsStartIndex》](https://github.com/yeyuqiudeng/pocket-lodash/issues/338) [《lodash源码分析之stringToArray》](https://github.com/yeyuqiudeng/pocket-lodash/issues/245) ##...

系列文章
api

本文为读 lodash 源码的第三百三十七篇,后续文章会更新到这个仓库中,欢迎 star:[pocket-lodash](https://github.com/yeyuqiudeng/pocket-lodash) gitbook也会同步仓库的更新,gitbook地址:[pocket-lodash](https://www.gitbook.com/book/yeyuqiudeng/pocket-lodash/details) ## 依赖 ```javascript import baseIndexOf from './baseIndexOf.js' ``` [《lodash源码分析之baseIndexOf》](https://github.com/yeyuqiudeng/pocket-lodash/issues/13) ## 源码分析 `chartsStartIndex` 的作用的找出 `strSymbols`字符串 数组中第一个不在 `chrSymbols` 字符串数组中出现的字符的位置。 源码如下: ```javascript function charsStartIndex(strSymbols, chrSymbols) { let index...

系列文章
internal

本文为读 lodash 源码的第三百三十六篇,后续文章会更新到这个仓库中,欢迎 star:[pocket-lodash](https://github.com/yeyuqiudeng/pocket-lodash) gitbook也会同步仓库的更新,gitbook地址:[pocket-lodash](https://www.gitbook.com/book/yeyuqiudeng/pocket-lodash/details) ## 依赖 ```javascript import baseIndexOf from './baseIndexOf.js' ``` [《lodash源码分析之baseIndexOf》](https://github.com/yeyuqiudeng/pocket-lodash/issues/13) ## 源码分析 `charsEndIndex` 是一个内部方法,会在 `trim` 和 `trimEnd` 中使用,作用是找出 `strSymbols` 字符串数组中,从后往前数,第一个不在 `charSymbols` 字符串数组中出现的字符的位置。 源码如下: ```javascript function charsEndIndex(strSymbols,...

系列文章
internal