mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Fix doc bugs in _.runInContext, _.thru, _.forEachRight, & _.escapeRegExp. [closes #1065] [ci skip]
This commit is contained in:
@@ -115,7 +115,8 @@
|
||||
/**
|
||||
* Used to match `RegExp` special characters.
|
||||
* See this [article on `RegExp` characters](http://www.regular-expressions.info/characters.html#special)
|
||||
* for more details.
|
||||
* for more details. In addition the forward slash is escaped to allow for
|
||||
* easier `eval` and `Function` compilation use.
|
||||
*/
|
||||
var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g,
|
||||
reHasRegExpChars = RegExp(reRegExpChars.source);
|
||||
@@ -686,19 +687,19 @@
|
||||
* @returns {Function} Returns a new `lodash` function.
|
||||
* @example
|
||||
*
|
||||
* _.mixin({ 'add': function(a, b) { return a + b; } });
|
||||
* _.mixin({ 'foo': _.constant('foo') });
|
||||
*
|
||||
* var lodash = _.runInContext();
|
||||
* lodash.mixin({ 'sub': function(a, b) { return a - b; } });
|
||||
* lodash.mixin({ 'bar': lodash.constant('bar') });
|
||||
*
|
||||
* _.isFunction(_.add);
|
||||
* _.isFunction(_.foo);
|
||||
* // => true
|
||||
* _.isFunction(_.sub);
|
||||
* _.isFunction(_.bar);
|
||||
* // => false
|
||||
*
|
||||
* lodash.isFunction(lodash.add);
|
||||
* lodash.isFunction(lodash.foo);
|
||||
* // => false
|
||||
* lodash.isFunction(lodash.sub);
|
||||
* lodash.isFunction(lodash.bar);
|
||||
* // => true
|
||||
*
|
||||
* // using `context` to mock `Date#getTime` use in `_.now`
|
||||
@@ -5910,13 +5911,14 @@
|
||||
* @returns {*} Returns the result of `interceptor`.
|
||||
* @example
|
||||
*
|
||||
* _([1, 2, 3])
|
||||
* .last()
|
||||
* _(' abc ')
|
||||
* .chain()
|
||||
* .trim()
|
||||
* .thru(function(value) {
|
||||
* return [value];
|
||||
* })
|
||||
* .value();
|
||||
* // => [3]
|
||||
* // => ['abc']
|
||||
*/
|
||||
function thru(value, interceptor, thisArg) {
|
||||
return interceptor.call(thisArg, value);
|
||||
@@ -6430,7 +6432,7 @@
|
||||
*
|
||||
* _([1, 2]).forEachRight(function(n) {
|
||||
* console.log(n);
|
||||
* }).join(',');
|
||||
* }).value();
|
||||
* // => logs each value from right to left and returns the array
|
||||
*/
|
||||
var forEachRight = createForEach(arrayEachRight, baseEachRight);
|
||||
@@ -10118,8 +10120,8 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes the `RegExp` special characters "\", "^", "$", ".", "|", "?", "*",
|
||||
* "+", "(", ")", "[", "]", "{" and "}" in `string`.
|
||||
* Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?",
|
||||
* "*", "+", "(", ")", "[", "]", "{" and "}" in `string`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -10129,7 +10131,7 @@
|
||||
* @example
|
||||
*
|
||||
* _.escapeRegExp('[lodash](https://lodash.com/)');
|
||||
* // => '\[lodash\]\(https://lodash\.com/\)'
|
||||
* // => '\[lodash\]\(https:\/\/lodash\.com\/\)'
|
||||
*/
|
||||
function escapeRegExp(string) {
|
||||
string = baseToString(string);
|
||||
|
||||
Reference in New Issue
Block a user