自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 收藏
  • 关注

原创 创建一个函数,调用func时,this绑定到创建的新函数,并且start之后的参数作为数组传入

/** * 创建一个函数,调用func时,this绑定到创建的新函数,并且start之后的参数作为数组传入 * Creates a function that invokes `func` with the `this` binding of the * created function and arguments from `start` and beyond provided as a...

2019-08-24 18:53:50 529

原创 检查value是否是一个原生函数

/** * 检查value是否是一个原生函数 * Checks if `value` is a pristine native function * @param {*} value The value to check * @returns {boolean} Returns `true` if `value` is a native function, else `false` *...

2019-08-23 15:48:47 179

原创 创建一个调用函数,使调用次数不操过n次,之后再调用这个函数,将返回一次最后调用func的结果

/** * 创建一个调用函数,通过this绑定和创建函数的参数调用func,调用次数不操过n次,之后再调用这个函数, * 将返回一次最后调用func的结果 * Creates a function that invokes `func`, with the `this` binding and arguments * of the created function, while it's...

2019-08-21 11:58:47 507

原创 计算数组的平均值

/** * 计算array的平均值 * Computes the mean of the values in `array` * @param {Array} array The array to iterate over * @returns {number} Returns the mean * @example * mean([4, 2, 8, 6]) * // => ...

2019-08-20 16:40:21 823

原创 计算数组中的最大值,如果数组是空的或者是非数组则返回undefined

/** * 计算array中的最大值,如果array是空的或者是非数组则返回undefined * computes the maximum value of `array`. If `array` is empty or falsey * `undefined` is returned. * @param {Array} array The array to iterate over...

2019-08-20 15:46:28 387

原创 根据precision(精度)向上舍入number

/** * 根据precision(精度)向上舍入number。(precision(精度)可以理解为保留几位小数) * Computes `number` rounded up to `precision` * @param {number} number The number to round up * @param {number} [precision=0] The precis...

2019-08-19 17:34:14 501

原创 两个数相加

/** * Adds two numbers * 两个数相加 * @param {number} augend The first number in an addition * @param {number} addend The second number in an addition * @returns {number} Returns the total * @exampl...

2019-08-19 15:11:44 434

原创 产生一个包括lower与upper之间的数

/** * 产生一个包括lower与upper之间的数,如果只提供一个参数返回一个0到提供数之间的数, * 如果floating设为true,或者lower或upper是浮点数,结果返回浮点数 * @param {number} [lower=0] The lower bound * @param {number} [upper=1] The upper bound * @param ...

2019-08-19 10:37:29 380

原创 检查数值是否在start与end之间,但不包括end

/** * 检查n是否在start与end之间,但不包括end。如果end没有指定,那么start设置为0, * 如果start大于end,那么参数会交换以便支持负范围。 * Checks if `n` is between `start` and up to, but not including, `end`. * If `end` is not specified, it's set...

2019-08-08 22:22:28 473

转载 重复N次给定字符串

/** * 重复N次给定字符串 * Repeats the given string `n` times * @param {string} [string=''] The string to repeat * @param {number} [n=1] The number of times to repeat the string * @returns {string} Retur...

2019-08-06 11:18:16 1297

转载 转义字符串中的'&', '<', '>', '"', "'", "`" 字符为HTML实体字符

/** * 转义字符串中的'&', '<', '>', '"', "'", "`" 字符为HTML实体字符 * **注意:** 不会转义其他字符 * Converts the characters '&', '<', '>', '"', "'", "`" in `string` to their corresponding HTML entities...

2019-08-06 11:17:44 977

转载 替换字符串中匹配的字符为给定的替代字符

/** * 替换string字符串中匹配的pattern为给定的replacement * Replaces matches for `pattern` in `string` with `replacement` * @param {string} [string=''] The string to modify * @param {RegExp|string} pattern The...

2019-08-06 11:16:37 502

原创 如果字符串长度小于length则从左侧和右侧填充字符,如果没法平均分配,则截断超出的长度

/** * 如果string字符串长度小于length则从左侧和右侧填充字符,如果没法平均分配,则截断超出的长度 * Pads `string` on the left and right sides if it's shorter than `length`. * Padding characters are truncated if they can't be evenly divid...

2019-08-05 22:59:30 372

原创 转换字符串以空格分开单词,并转为小写

/** * 转换字符串以空格分开单词,并转为小写 * Converts `string`, as space separated words, to lower case * @param {string} [string=''] The string to convert * @returns {string} Returns the lower cased string * @ex...

2019-08-04 23:53:50 410

原创 转换字符串为中滑线连接格式

/** * 转换字符串为中滑线连接格式 * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles) * @param {string} [string=''] The string to convert * @returns {string} Retu...

2019-08-04 00:02:28 229

原创 转义RegExp字符串中特殊的字符"^", "$", "\", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", "|"

/** * 转义RegExp字符串中特殊的字符"^", "$", "\", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", "|" * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", * "?", "(", ")", "[", "]", "{", ...

2019-08-03 22:02:03 7640

原创 检查字符串是否以给定的字符串结尾

/** * 检查字符串string是否以给定的target字符串结尾 * Checks if `string` ends with the given target string * @param {string} [string=''] The string to inspect * @param {string} [target] The string to search for ...

2019-08-02 17:32:03 490

原创 转换字符串string为驼峰写法

/** * 转换字符串string为驼峰写法 * Converts `string` to [camel case] * @param {string} [string=''] The string to convert * @returns {string} Returns the camel cased string * @example * camelCase('Foo Bar...

2019-08-02 16:15:59 1559

原创 拆分字符串string中的词变为数组

/** * 拆分字符串string中的词为数组 * Splits `string` into an array of its words * @param {string} [string=''] The string to inspect * @param {RegExp|string} [pattern] The pattern to match words * @returns ...

2019-08-02 12:30:47 289

原创 转换字符串string中拉丁语-1补充字母和拉丁语扩张字母-A为基本的拉丁字母,并且去除组合变音标记

/** * 转换字符串string中拉丁语-1补充字母和拉丁语扩张字母-A为基本的拉丁字母,并且去除组合变音标记 * Deburrs `string` by converting * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) ...

2019-08-01 17:22:12 1241

原创 转换字符串string的首字母为大写(或小写)

/** * 转换字符串string的首字母为大写 * Converts the first character of `string` to upper case * * @param {string} [string=''] The string to convert * @returns {string} Returns the converted string * @examp...

2019-08-01 11:54:24 2525

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除