### Convert to start case with _.startCase Source: https://lodash.com/docs Transforms a string into start case format. ```javascript _.startCase('--foo-bar--'); // => 'Foo Bar' _.startCase('fooBar'); // => 'Foo Bar' _.startCase('__FOO_BAR__'); // => 'FOO BAR' ``` -------------------------------- ### _.startCase([string='']) Source: https://lodash.com/docs Converts a string to start case. ```APIDOC ## _.startCase([string='']) ### Description Converts `string` to start case. ### Arguments - **string** (string) - Optional - The string to convert. ### Returns - (string) - Returns the start cased string. ``` -------------------------------- ### Install Lodash via npm Source: https://lodash.com/ Install Lodash globally and then as a project dependency using npm. ```bash $ npm i -g npm $ npm i --save lodash ``` -------------------------------- ### Install lodash-cli Globally Source: https://lodash.com/custom-builds Install the lodash-cli globally to use its command-line interface for custom builds. This command installs the package and makes the `lodash` command available in your terminal. ```bash $ npm i -g lodash-cli $ lodash -h ``` -------------------------------- ### _.sample(collection) Source: https://lodash.com/docs Gets a random element from collection. ```APIDOC ## _.sample(collection) ### Description Gets a random element from collection. ### Arguments - **collection** (Array|Object) - Required - The collection to sample. ### Returns - **(*)** - Returns the random element. ``` -------------------------------- ### _.startsWith([string=''], [target], [position=0]) Source: https://lodash.com/docs Checks if a string starts with the given target string. ```APIDOC ## _.startsWith([string=''], [target], [position=0]) ### Description Checks if `string` starts with the given target string. ### Arguments - **string** (string) - Optional - The string to inspect. - **target** (string) - Optional - The string to search for. - **position** (number) - Optional - The position to search from. ### Returns - (boolean) - Returns `true` if `string` starts with `target`, else `false`. ``` -------------------------------- ### Check string prefixes with _.startsWith Source: https://lodash.com/docs Determines if a string begins with a specific substring, optionally starting from a given index. ```javascript _.startsWith('abc', 'a'); // => true _.startsWith('abc', 'b'); // => false _.startsWith('abc', 'b', 1); // => true ``` -------------------------------- ### _.head(array) Source: https://lodash.com/docs Gets the first element of array. ```APIDOC ## _.head(array) ### Description Gets the first element of array. ### Arguments - **array** (Array) - The array to query. ### Returns - **(*)** - Returns the first element of array. ``` -------------------------------- ### Lodash Partition Example Source: https://lodash.com/ Use _.partition to split elements into two groups based on the return value of the predicate function. ```javascript _.partition([1, 2, 3, 4], n => n % 2); // → [[1, 3], [2, 4]] ``` -------------------------------- ### Clone chain sequence with _.prototype.plant() Source: https://lodash.com/docs Creates a clone of the current chain sequence and plants a new value as the starting point. ```javascript function square(n) {   return n * n; }   var wrapped = _([1, 2]).map(square); var other = wrapped.plant([3, 4]);   other.value(); // => [9, 16]   wrapped.value(); // => [1, 4] ``` -------------------------------- ### _.sampleSize(collection, [n=1]) Source: https://lodash.com/docs Gets n random elements at unique keys from collection up to the size of collection. ```APIDOC ## _.sampleSize(collection, [n=1]) ### Description Gets n random elements at unique keys from collection up to the size of collection. ### Arguments - **collection** (Array|Object) - The collection to sample. - **[n=1]** (number) - The number of elements to sample. ### Returns - **(Array)** - Returns the random elements. ``` -------------------------------- ### _.range([start=0], end, [step=1]) Source: https://lodash.com/docs Creates an array of numbers progressing from start up to, but not including, end. ```APIDOC ## _.range([start=0], end, [step=1]) ### Description Creates an array of numbers (positive and/or negative) progressing from `start` up to, but not including, `end`. ### Arguments - **[start=0]** (number) - Optional - The start of the range. - **end** (number) - Required - The end of the range. - **[step=1]** (number) - Optional - The value to increment or decrement by. ### Returns - **Array** - Returns the range of numbers. ``` -------------------------------- ### Trim leading characters with _.trimStart Source: https://lodash.com/docs Removes leading whitespace or specified characters from the start of a string. ```javascript _.trimStart('  abc  '); // => 'abc  '   _.trimStart('-_-abc-_-', '_-'); // => 'abc-_-' ``` -------------------------------- ### _.now() Source: https://lodash.com/docs Gets the timestamp of the number of milliseconds that have elapsed since the Unix epoch. ```APIDOC ## _.now() ### Description Gets the timestamp of the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC). ### Returns - **timestamp** (number) - The current timestamp in milliseconds. ``` -------------------------------- ### Apply rest parameters with _.rest Source: https://lodash.com/docs Collects arguments from a specified start index into an array. This method is based on the native rest parameter syntax. ```javascript var say = _.rest(function(what, names) {   return what + ' ' + _.initial(names).join(', ') +     (_.size(names) > 1 ? ', & ' : '') + _.last(names); });   say('hello', 'fred', 'barney', 'pebbles'); // => 'hello fred, barney, & pebbles' ``` -------------------------------- ### Get initial elements Source: https://lodash.com/docs Returns all elements of an array except the last one. ```javascript _.initial([1, 2, 3]); // => [1, 2] ``` -------------------------------- ### _.rest(func, [start=func.length-1]) Source: https://lodash.com/docs Creates a function that invokes func with the this binding of the created function and arguments from start and beyond provided as an array. ```APIDOC ## _.rest(func, [start=func.length-1]) ### Description Creates a function that invokes func with the this binding of the created function and arguments from start and beyond provided as an array. ### Arguments - **func** (Function) - The function to apply a rest parameter to. - **[start=func.length-1]** (number) - The start position of the rest parameter. ### Returns - **(Function)** - Returns the new function. ``` -------------------------------- ### _.padStart([string=''], [length=0], [chars=' ']) Source: https://lodash.com/docs Pads a string on the left side if it is shorter than the specified length. ```APIDOC ## _.padStart([string=''], [length=0], [chars=' ']) ### Description Pads `string` on the left side if it's shorter than `length`. Padding characters are truncated if they exceed `length`. ### Arguments - **string** (string) - Optional - The string to pad. - **length** (number) - Optional - The padding length. - **chars** (string) - Optional - The string used as padding. ### Returns - (string) - Returns the padded string. ``` -------------------------------- ### Lodash Defaults Example Source: https://lodash.com/ Use _.defaults to assign properties from source objects to the destination object for all undefined properties. ```javascript _.defaults({"a": 1}, {"a": 3, "b": 2}); // → { "a": 1, "b": 2 } ``` -------------------------------- ### Display Help Information Source: https://lodash.com/custom-builds Show the help information for the lodash-cli, listing all available commands and options. Use the `-h` or `--help` flag. ```bash -h ``` -------------------------------- ### Pad strings with _.padStart Source: https://lodash.com/docs Pads a string on the left side to a specified length using a custom character sequence. ```javascript _.padStart('abc', 6); // => ' abc' _.padStart('abc', 6, '_-'); // => '_-_abc' _.padStart('abc', 3); // => 'abc' ``` -------------------------------- ### _.last Source: https://lodash.com/docs Gets the last element of an array. ```APIDOC ## _.last(array) ### Description Gets the last element of `array`. ### Arguments - **array** (Array) - The array to query. ### Returns - **(*)** - Returns the last element of `array`. ``` -------------------------------- ### Retrieve object values by path with _.get Source: https://lodash.com/docs Gets the value at a specific path of an object, returning a default value if the path resolves to undefined. ```javascript var object = { 'a': [{ 'b': { 'c': 3 } }] };   _.get(object, 'a[0].b.c'); // => 3   _.get(object, ['a', '0', 'b', 'c']); // => 3   _.get(object, 'a.b.c', 'default'); // => 'default' ``` -------------------------------- ### _.tail(array) Source: https://lodash.com/docs Gets all but the first element of an array. ```APIDOC ## _.tail(array) ### Description Gets all but the first element of `array`. ### Parameters - **array** (Array) - Required - The array to query. ### Returns - **(Array)** - Returns the slice of `array`. ``` -------------------------------- ### _.nth Source: https://lodash.com/docs Gets the element at a specific index of an array. ```APIDOC ## _.nth(array, [n=0]) ### Description Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. ### Arguments - **array** (Array) - The array to query. - **[n=0]** (number) - The index of the element to return. ### Returns - **(*)** - Returns the nth element of `array`. ``` -------------------------------- ### Specify Output Path Source: https://lodash.com/custom-builds Write the build output to a specific file path or filename. Use the `-o` or `--output` flag. ```bash -o ``` -------------------------------- ### _.initial(array) Source: https://lodash.com/docs Gets all but the last element of array. ```APIDOC ## _.initial(array) ### Description Gets all but the last element of array. ### Arguments - **array** (Array) - The array to query. ### Returns - **(Array)** - Returns the slice of array. ``` -------------------------------- ### Write Output to Standard Output Source: https://lodash.com/custom-builds Redirect the build output to standard output instead of writing to a file. Use the `-c` or `--stdout` flag. ```bash -c ``` -------------------------------- ### _.lastIndexOf Source: https://lodash.com/docs Gets the index of the last occurrence of a value in an array. ```APIDOC ## _.lastIndexOf(array, value, [fromIndex=array.length-1]) ### Description This method is like `_.indexOf` except that it iterates over elements of `array` from right to left. ### Arguments - **array** (Array) - The array to inspect. - **value** (*) - The value to search for. - **[fromIndex=array.length-1]** (number) - The index to search from. ### Returns - **(number)** - Returns the index of the matched value, else `-1`. ``` -------------------------------- ### _.nthArg([n=0]) Source: https://lodash.com/docs Creates a function that gets the argument at index n. ```APIDOC ## _.nthArg([n=0]) ### Description Creates a function that gets the argument at index `n`. If `n` is negative, the nth argument from the end is returned. ### Arguments - **[n=0]** (number) - Optional - The index of the argument to return. ### Returns - **Function** - Returns the new pass-thru function. ``` -------------------------------- ### _.inRange(number, [start=0], end) Source: https://lodash.com/docs Checks if a number is between start and up to, but not including, end. ```APIDOC ## _.inRange(number, [start=0], end) ### Description Checks if `number` is between `start` and up to, but not including, `end`. If `end` is not specified, it's set to `start` with `start` then set to `0`. If `start` is greater than `end` the params are swapped to support negative ranges. ### Arguments - **number** (number) - The number to check. - **[start=0]** (number) - The start of the range. - **end** (number) - The end of the range. ### Returns - (boolean) - Returns `true` if `number` is in the range, else `false`. ### Example _.inRange(3, 2, 4); // => true _.inRange(4, 8); // => true ``` -------------------------------- ### _.bindKey(object, key, [partials]) Source: https://lodash.com/docs Creates a function that invokes the method at object[key] with partials prepended to the arguments. ```APIDOC ## _.bindKey(object, key, [partials]) ### Description Creates a function that invokes the method at object[key] with partials prepended to the arguments it receives. This method allows bound functions to reference methods that may be redefined or don't yet exist. ### Arguments - **object** (Object) - The object to invoke the method on. - **key** (string) - The key of the method. - **partials** (...*) - Optional. The arguments to be partially applied. ### Returns - **function** (Function) - Returns the new bound function. ``` -------------------------------- ### _.slice(array, [start=0], [end=array.length]) Source: https://lodash.com/docs Creates a slice of an array from start to end. ```APIDOC ## _.slice(array, [start=0], [end=array.length]) ### Description Creates a slice of `array` from `start` up to, but not including, `end`. ### Arguments - **array** (Array) - The array to slice. - **[start=0]** (number) - The start position. - **[end=array.length]** (number) - The end position. ### Returns - **(Array)** - Returns the slice of `array`. ``` -------------------------------- ### _.prototype.next() Source: https://lodash.com/docs Gets the next value on a wrapped object following the iterator protocol. ```APIDOC ## _.prototype.next() ### Description Gets the next value on a wrapped object following the iterator protocol. ### Returns - **Object** - Returns the next iterator value. ``` -------------------------------- ### _.noop() Source: https://lodash.com/docs Returns undefined. ```APIDOC ## _.noop() ### Description This method returns `undefined`. ``` -------------------------------- ### Get tail of array Source: https://lodash.com/docs Returns all elements of an array except the first one. ```javascript _.tail([1, 2, 3]); // => [2, 3] ``` -------------------------------- ### Generate Source Map Source: https://lodash.com/custom-builds Create a source map for the build output, which can be used for debugging. An optional source map URL can be specified. Use the `-m` or `--source-map` flag. ```bash -m ``` -------------------------------- ### _.trimStart Source: https://lodash.com/docs Removes leading whitespace or specified characters from a string. ```APIDOC ## _.trimStart([string=''], [chars=whitespace]) ### Description Removes leading whitespace or specified characters from `string`. ### Arguments - **string** (string) - Optional - The string to trim. - **chars** (string) - Optional - The characters to trim. ### Returns - (string) - Returns the trimmed string. ``` -------------------------------- ### Get the last element of an array Source: https://lodash.com/docs Retrieves the final element from the provided array. ```javascript _.last([1, 2, 3]); // => 3 ``` -------------------------------- ### Build with Specific Categories Source: https://lodash.com/custom-builds Create a custom build by specifying comma-separated categories of functions to include. Valid categories include array, collection, date, function, lang, object, number, seq, string, and util. ```bash lodash category=collection,function ``` -------------------------------- ### Retrieve values at paths with .at Source: https://lodash.com/docs Wrapper version of _.at that picks values from an object based on provided paths. ```javascript var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };   _(object).at(['a[0].b.c', 'a[1]']).value(); // => [3, 4] ``` -------------------------------- ### Get unique values from sorted array Source: https://lodash.com/docs Optimized version of uniq for sorted arrays. ```javascript _.sortedUniq([1, 1, 2]); // => [1, 2] ``` -------------------------------- ### Create a Core Build Source: https://lodash.com/custom-builds Generate a core build of Lodash, which is a minimal build approximately 4kB in size. Use the `core` modifier to create this build. ```bash lodash core ``` -------------------------------- ### Generate Production Output Source: https://lodash.com/custom-builds Create a minified production version of the Lodash build. Use the `-p` or `--production` flag. ```bash -p ``` -------------------------------- ### Sample elements from a collection with _.sampleSize Source: https://lodash.com/docs Retrieves a specified number of random elements from a collection. ```javascript _.sampleSize([1, 2, 3], 2); // => [3, 1]   _.sampleSize([1, 2, 3], 4); // => [2, 3, 1] ``` -------------------------------- ### _.pick(object, [paths]) Source: https://lodash.com/docs Creates an object composed of the picked object properties. ```APIDOC ## _.pick(object, [paths]) ### Description Creates an object composed of the picked object properties. ### Arguments - **object** (Object) - The source object. - **[paths]** (...(string|string[])) - The property paths to pick. ### Returns - (Object) - Returns the new object. ``` -------------------------------- ### Get first element Source: https://lodash.com/docs Retrieves the first element of an array. Returns undefined for empty arrays. ```javascript _.head([1, 2, 3]); // => 1   _.head([]); // => undefined ``` -------------------------------- ### _.fill(array, value, [start=0], [end=array.length]) Source: https://lodash.com/docs Fills elements of array with value from start up to, but not including, end. ```APIDOC ## _.fill(array, value, [start=0], [end=array.length]) ### Description Fills elements of `array` with `value` from `start` up to, but not including, `end`. Note: This method mutates `array`. ### Arguments - **array** (Array) - Required - The array to fill. - **value** (*) - Required - The value to fill `array` with. - **[start=0]** (number) - Optional - The start position. - **[end=array.length]** (number) - Optional - The end position. ### Returns - (Array) - Returns `array`. ``` -------------------------------- ### _.keysIn(object) Source: https://lodash.com/docs Creates an array of the own and inherited enumerable property names of object. ```APIDOC ## _.keysIn(object) ### Description Creates an array of the own and inherited enumerable property names of object. Non-object values are coerced to objects. ### Arguments - **object** (Object) - The object to query. ### Returns - **(Array)** - Returns the array of property names. ``` -------------------------------- ### Get collection size with _.size Source: https://lodash.com/docs Returns the length of array-like values or the count of own enumerable properties for objects. ```javascript _.size([1, 2, 3]); // => 3   _.size({ 'a': 1, 'b': 2 }); // => 2   _.size('pebbles'); // => 7 ``` -------------------------------- ### Generate Development Output Source: https://lodash.com/custom-builds Create a non-minified development version of the Lodash build. Use the `-d` or `--development` flag. ```bash -d ``` -------------------------------- ### Get element at index Source: https://lodash.com/docs Retrieves the element at a specific index. Negative indices count from the end of the array. ```javascript var array = ['a', 'b', 'c', 'd']; _.nth(array, 1); // => 'b' _.nth(array, -2); // => 'c'; ``` -------------------------------- ### _.prototype.plant(value) Source: https://lodash.com/docs Creates a clone of the chain sequence planting value as the wrapped value. ```APIDOC ## _.prototype.plant(value) ### Description Creates a clone of the chain sequence planting value as the wrapped value. ### Arguments - **value** (*) - The value to plant. ### Returns - **Object** - Returns the new lodash wrapper instance. ``` -------------------------------- ### _.mapKeys(object, [iteratee=_.identity]) Source: https://lodash.com/docs Creates an object with the same values as object and keys generated by running each own enumerable string keyed property of object thru iteratee. ```APIDOC ## _.mapKeys(object, [iteratee=_.identity]) ### Description Creates an object with the same values as object and keys generated by running each own enumerable string keyed property of object thru iteratee. ### Arguments - **object** (Object) - The object to iterate over. - **[iteratee=_.identity]** (Function) - The function invoked per iteration. ### Returns - **(Object)** - Returns the new mapped object. ``` -------------------------------- ### Find the last index of a value Source: https://lodash.com/docs Searches for a value in an array from right to left, optionally starting from a specific index. ```javascript _.lastIndexOf([1, 2, 1, 2], 2); // => 3 // Search from the `fromIndex`. _.lastIndexOf([1, 2, 1, 2], 2, 2); // => 1 ``` -------------------------------- ### _.spread(func, [start=0]) Source: https://lodash.com/docs Creates a function that invokes func with the this binding of the create function and an array of arguments. ```APIDOC ## _.spread(func, [start=0]) ### Description Creates a function that invokes func with the this binding of the create function and an array of arguments much like Function#apply. ### Arguments - **func** (Function) - The function to spread arguments over. - **[start=0]** (number) - The start position of the spread. ### Returns - **(Function)** - Returns the new function. ``` -------------------------------- ### _.partition(collection, [predicate=_.identity]) Source: https://lodash.com/docs Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, the second of which contains elements predicate returns falsey for. ```APIDOC ## _.partition(collection, [predicate=_.identity]) ### Description Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, the second of which contains elements predicate returns falsey for. ### Arguments - **collection** (Array|Object) - Required - The collection to iterate over. - **predicate** (Function) - Optional - The function invoked per iteration. ### Returns - **Array** - Returns the array of grouped elements. ``` -------------------------------- ### Find index of value Source: https://lodash.com/docs Finds the index of the first occurrence of a value in an array, optionally starting from a specific index. ```javascript _.indexOf([1, 2, 1, 2], 2); // => 1   // Search from the `fromIndex`. _.indexOf([1, 2, 1, 2], 2, 2); // => 3 ``` -------------------------------- ### Drop elements from the beginning of an array Source: https://lodash.com/docs Creates a new array slice by removing a specified number of elements from the start. ```javascript _.drop([1, 2, 3]); // => [2, 3] _.drop([1, 2, 3], 2); // => [3] _.drop([1, 2, 3], 5); // => [] _.drop([1, 2, 3], 0); // => [1, 2, 3] ``` -------------------------------- ### _.create(prototype, [properties]) Source: https://lodash.com/docs Creates an object that inherits from the provided prototype object, optionally assigning properties. ```APIDOC ## _.create(prototype, [properties]) ### Description Creates an object that inherits from the prototype object. If a properties object is given, its own enumerable string keyed properties are assigned to the created object. ### Arguments - **prototype** (Object) - Required - The object to inherit from. - **[properties]** (Object) - Optional - The properties to assign to the object. ### Returns - (Object) - Returns the new object. ``` -------------------------------- ### Get next iterator value with _.prototype.next() Source: https://lodash.com/docs Retrieves the next value from a wrapped object following the iterator protocol. ```javascript var wrapped = _([1, 2]);   wrapped.next(); // => { 'done': false, 'value': 1 }   wrapped.next(); // => { 'done': false, 'value': 2 }   wrapped.next(); // => { 'done': true, 'value': undefined } ``` -------------------------------- ### _.take(array, [n=1]) Source: https://lodash.com/docs Creates a slice of an array with n elements taken from the beginning. ```APIDOC ## _.take(array, [n=1]) ### Description Creates a slice of `array` with `n` elements taken from the beginning. ### Parameters - **array** (Array) - Required - The array to query. - **n** (number) - Optional - The number of elements to take. ### Returns - **(Array)** - Returns the slice of `array`. ``` -------------------------------- ### _.get(object, path, [defaultValue]) Source: https://lodash.com/docs Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned. ```APIDOC ## _.get(object, path, [defaultValue]) ### Description Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. ### Parameters - **object** (Object) - Required - The object to query. - **path** (Array|string) - Required - The path of the property to get. - **defaultValue** (*) - Optional - The value returned for undefined resolved values. ### Returns - **(*)** - Returns the resolved value. ``` -------------------------------- ### _.prototype.at([paths]) Source: https://lodash.com/docs The wrapper version of _.at, used to pick property paths from a wrapped object. ```APIDOC ## _.prototype.at([paths]) ### Description This method is the wrapper version of _.at. ### Arguments - **[paths]** (...(string|string[])) - Optional - The property paths to pick. ### Returns - **Object** - Returns the new lodash wrapper instance. ``` -------------------------------- ### Get function property names with _.functions Source: https://lodash.com/docs Creates an array of function property names from own enumerable properties of an object. ```javascript function Foo() {   this.a = _.constant('a');   this.b = _.constant('b'); }   Foo.prototype.c = _.constant('c');   _.functions(new Foo); // => ['a', 'b'] ``` -------------------------------- ### Get current timestamp with _.now() Source: https://lodash.com/docs Calculates the elapsed time by comparing the current timestamp with a previously captured one. ```javascript _.defer(function(stamp) {   console.log(_.now() - stamp); }, _.now()); // => Logs the number of milliseconds it took for the deferred invocation. ``` -------------------------------- ### Pick properties from an object using _.pick Source: https://lodash.com/docs Creates a new object containing only the specified property paths from the source object. ```javascript var object = { 'a': 1, 'b': '2', 'c': 3 };   _.pick(object, ['a', 'c']); // => { 'a': 1, 'c': 3 } ``` -------------------------------- ### Get unique values from sorted array with iteratee Source: https://lodash.com/docs Optimized version of uniqBy for sorted arrays using an iteratee. ```javascript _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); // => [1.1, 2.3] ``` -------------------------------- ### Clone with customizer using _.cloneWith Source: https://lodash.com/docs Creates a clone of a value, allowing customization of the cloning process via a callback. ```javascript function customizer(value) {   if (_.isElement(value)) {     return value.cloneNode(false);   } }   var el = _.cloneWith(document.body, customizer);   console.log(el === document.body); // => false console.log(el.nodeName); // => 'BODY' console.log(el.childNodes.length); // => 0 ``` -------------------------------- ### _.pad([string=''], [length=0], [chars=' ']) Source: https://lodash.com/docs Pads a string on the left and right sides if it's shorter than length. ```APIDOC ## _.pad([string=''], [length=0], [chars=' ']) ### Description Pads `string` on the left and right sides if it's shorter than `length`. ### Arguments - **string** (string) - Optional - The string to pad. - **length** (number) - Optional - The padding length. - **chars** (string) - Optional - The string used as padding. ### Returns - (string) - Returns the padded string. ### Example _.pad('abc', 8); // => ' abc ' ``` -------------------------------- ### Configure Template Settings Source: https://lodash.com/custom-builds Pass specific template settings to be used during the precompilation of templates. This allows customization of interpolation, escape, and other template behaviors. ```bash lodash settings="{interpolate:/\{\{([sS]+?)\}\/g}" ``` -------------------------------- ### _.padEnd([string=''], [length=0], [chars=' ']) Source: https://lodash.com/docs Pads a string on the right side if it is shorter than the specified length. ```APIDOC ## _.padEnd([string=''], [length=0], [chars=' ']) ### Description Pads `string` on the right side if it's shorter than `length`. Padding characters are truncated if they exceed `length`. ### Arguments - **string** (string) - Optional - The string to pad. - **length** (number) - Optional - The padding length. - **chars** (string) - Optional - The string used as padding. ### Returns - (string) - Returns the padded string. ``` -------------------------------- ### Fill an array with a value Source: https://lodash.com/docs Fills elements of an array with a value from start to end. Note that this method mutates the original array. ```javascript var array = [1, 2, 3]; _.fill(array, 'a'); console.log(array); // => ['a', 'a', 'a'] _.fill(Array(3), 2); // => [2, 2, 2] _.fill([4, 6, 8, 10], '*', 1, 3); // => [4, '*', '*', 10] ``` -------------------------------- ### _.assignInWith(object, sources, [customizer]) Source: https://lodash.com/docs Similar to _.assignIn, but accepts a customizer function to determine assigned values. ```APIDOC ## _.assignInWith(object, sources, [customizer]) ### Description This method is like _.assignIn except that it accepts a customizer which is invoked to produce the assigned values. If the customizer returns undefined, assignment is handled by the method instead. ### Arguments - **object** (Object) - Required - The destination object. - **sources** (...Object) - Required - The source objects. - **[customizer]** (Function) - Optional - The function to customize assigned values. ### Returns - (Object) - Returns the destination object. ``` -------------------------------- ### Output Version Information Source: https://lodash.com/custom-builds Display the current version of Lodash. Use the `-V` or `--version` flag. ```bash -V ``` -------------------------------- ### Include Specific Functions Source: https://lodash.com/custom-builds Build Lodash with only a specified list of functions. This is useful for creating highly optimized builds with only the required utilities. ```bash lodash include=each,filter,map ``` -------------------------------- ### Get argument at index with _.nthArg Source: https://lodash.com/docs Creates a function that returns the argument at a specified index, supporting negative indices for reverse lookup. ```javascript var func = _.nthArg(1); func('a', 'b', 'c', 'd'); // => 'b'   var func = _.nthArg(-2); func('a', 'b', 'c', 'd'); // => 'c' ``` -------------------------------- ### _.size(collection) Source: https://lodash.com/docs Gets the size of collection by returning its length for array-like values or the number of own enumerable string keyed properties for objects. ```APIDOC ## _.size(collection) ### Description Gets the size of collection by returning its length for array-like values or the number of own enumerable string keyed properties for objects. ### Arguments - **collection** (Array|Object|string) - The collection to inspect. ### Returns - **(number)** - Returns the collection size. ``` -------------------------------- ### _.kebabCase([string='']) Source: https://lodash.com/docs Converts a string to kebab case. ```APIDOC ## _.kebabCase([string='']) ### Description Converts `string` to kebab case. ### Arguments - **string** (string) - Optional - The string to convert. ### Returns - (string) - Returns the kebab cased string. ### Example _.kebabCase('Foo Bar'); // => 'foo-bar' ``` -------------------------------- ### _.indexOf(array, value, [fromIndex=0]) Source: https://lodash.com/docs Gets the index at which the first occurrence of value is found in array using SameValueZero for equality comparisons. ```APIDOC ## _.indexOf(array, value, [fromIndex=0]) ### Description Gets the index at which the first occurrence of value is found in array using SameValueZero for equality comparisons. If fromIndex is negative, it's used as the offset from the end of array. ### Arguments - **array** (Array) - The array to inspect. - **value** (*) - The value to search for. - **fromIndex** (number) - Optional - The index to search from. ### Returns - **(number)** - Returns the index of the matched value, else -1. ``` -------------------------------- ### Assign properties with customizer using _.assignInWith Source: https://lodash.com/docs Assigns properties including inherited ones, using a customizer function to determine assigned values. ```javascript function customizer(objValue, srcValue) {   return _.isUndefined(objValue) ? srcValue : objValue; }   var defaults = _.partialRight(_.assignInWith, customizer);   defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); // => { 'a': 1, 'b': 2 } ``` -------------------------------- ### _.rangeRight([start=0], end, [step=1]) Source: https://lodash.com/docs Creates an array of numbers in descending order. ```APIDOC ## _.rangeRight([start=0], end, [step=1]) ### Description This method is like `_.range` except that it populates values in descending order. ### Arguments - **[start=0]** (number) - Optional - The start of the range. - **end** (number) - Required - The end of the range. - **[step=1]** (number) - Optional - The value to increment or decrement by. ### Returns - **Array** - Returns the range of numbers. ``` -------------------------------- ### _.at(object, [paths]) Source: https://lodash.com/docs Creates an array of values corresponding to the provided paths of an object. ```APIDOC ## _.at(object, [paths]) ### Description Creates an array of values corresponding to paths of the object. ### Arguments - **object** (Object) - Required - The object to iterate over. - **[paths]** (...(string|string[])) - Optional - The property paths to pick. ### Returns - (Array) - Returns the picked values. ``` -------------------------------- ### _.stubObject() Source: https://lodash.com/docs Returns a new empty object. ```APIDOC ## _.stubObject() ### Description This method returns a new empty object. ### Returns - **Object** - Returns the new empty object. ``` -------------------------------- ### Get function property names including inherited with _.functionsIn Source: https://lodash.com/docs Creates an array of function property names from own and inherited enumerable properties of an object. ```javascript function Foo() {   this.a = _.constant('a');   this.b = _.constant('b'); }   Foo.prototype.c = _.constant('c');   _.functionsIn(new Foo); // => ['a', 'b', 'c'] ``` -------------------------------- ### Generate numeric ranges with _.range Source: https://lodash.com/docs Creates an array of numbers progressing from start to end. Note that floating-point results may vary due to IEEE-754 standards. ```javascript _.range(4); // => [0, 1, 2, 3]   _.range(-4); // => [0, -1, -2, -3]   _.range(1, 5); // => [1, 2, 3, 4]   _.range(0, 20, 5); // => [0, 5, 10, 15]   _.range(0, -4, -1); // => [0, -1, -2, -3]   _.range(1, 4, 0); // => [1, 1, 1]   _.range(0); // => [] ``` -------------------------------- ### Check if a number is in range using _.inRange Source: https://lodash.com/docs Determines if a number falls within a specified range, excluding the upper bound. Parameters are automatically swapped if the start value exceeds the end value. ```javascript _.inRange(3, 2, 4); // => true   _.inRange(4, 8); // => true   _.inRange(4, 2); // => false   _.inRange(2, 2); // => false   _.inRange(1.2, 2); // => true   _.inRange(5.2, 4); // => false   _.inRange(-3, -2, -6); // => true ``` -------------------------------- ### _.toPairsIn(object) Source: https://lodash.com/docs Creates an array of own and inherited enumerable string keyed-value pairs for object. ```APIDOC ## _.toPairsIn(object) ### Description Creates an array of own and inherited enumerable string keyed-value pairs for object which can be consumed by _.fromPairs. If object is a map or set, its entries are returned. ### Arguments - **object** (Object) - The object to query. ### Returns - **(Array)** - Returns the key-value pairs. ``` -------------------------------- ### _.setWith(object, path, value, [customizer]) Source: https://lodash.com/docs Sets the value at path of object. If a portion of path doesn't exist, it's created. Arrays are created for missing index properties while objects are created for all other missing properties. ```APIDOC ## _.setWith(object, path, value, [customizer]) ### Description This method is like _.set except that it accepts customizer which is invoked to produce the objects of path. If customizer returns undefined path creation is handled by the method instead. ### Arguments - **object** (Object) - The object to modify. - **path** (Array|string) - The path of the property to set. - **value** (*) - The value to set. - **[customizer]** (Function) - The function to customize assigned values. ### Returns - **(Object)** - Returns object. ``` -------------------------------- ### Assign properties with customizer using _.assignWith Source: https://lodash.com/docs Assigns own properties using a customizer function to determine assigned values. ```javascript function customizer(objValue, srcValue) {   return _.isUndefined(objValue) ? srcValue : objValue; }   var defaults = _.partialRight(_.assignWith, customizer);   defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); // => { 'a': 1, 'b': 2 } ``` -------------------------------- ### _.isMatchWith(object, source, [customizer]) Source: https://lodash.com/docs This method is like _.isMatch except that it accepts customizer which is invoked to compare values. ```APIDOC ## _.isMatchWith(object, source, [customizer]) ### Description This method is like _.isMatch except that it accepts customizer which is invoked to compare values. If customizer returns undefined, comparisons are handled by the method instead. ### Arguments - **object** (Object) - The object to inspect. - **source** (Object) - The object of property values to match. - **[customizer]** (Function) - The function to customize comparisons. ### Returns - **boolean** - Returns true if object is a match, else false. ``` -------------------------------- ### Add Functions to a Category Build Source: https://lodash.com/custom-builds Extend a build by adding specific functions to a category. This command combines category inclusion with the addition of specific utilities. ```bash lodash category=array plus=random,template ``` -------------------------------- ### Exclude Specific Functions or Categories Source: https://lodash.com/custom-builds Create a build by excluding specific functions or entire categories. Use the `minus` command for this purpose. ```bash lodash minus=result,shuffle ``` -------------------------------- ### _.toUpper Source: https://lodash.com/docs Converts a string to upper case. ```APIDOC ## _.toUpper([string='']) ### Description Converts `string`, as a whole, to upper case just like String#toUpperCase. ### Arguments - **string** (string) - Optional - The string to convert. ### Returns - (string) - Returns the upper cased string. ### Example _.toUpper('--foo-bar--'); // => '--FOO-BAR--' ``` -------------------------------- ### Enable explicit method chaining with _.chain Source: https://lodash.com/docs Creates a wrapper instance with explicit chaining enabled. Sequences must be terminated with .value(). ```javascript var users = [   { 'user': 'barney',  'age': 36 },   { 'user': 'fred',    'age': 40 },   { 'user': 'pebbles', 'age': 1 } ];   var youngest = _   .chain(users)   .sortBy('age')   .map(function(o) {     return o.user + ' is ' + o.age;   })   .head()   .value(); // => 'pebbles is 1' ``` -------------------------------- ### Create object with prototype using _.create Source: https://lodash.com/docs Creates a new object that inherits from the provided prototype, optionally assigning properties to it. ```javascript function Shape() {   this.x = 0;   this.y = 0; }   function Circle() {   Shape.call(this); }   Circle.prototype = _.create(Shape.prototype, {   'constructor': Circle });   var circle = new Circle; circle instanceof Circle; // => true   circle instanceof Shape; // => true ``` -------------------------------- ### _.stubArray() Source: https://lodash.com/docs Returns a new empty array. ```APIDOC ## _.stubArray() ### Description This method returns a new empty array. ### Returns - **Array** - Returns the new empty array. ``` -------------------------------- ### Bind function context with _.bind() Source: https://lodash.com/docs Creates a function with a fixed 'this' context and partially applied arguments, supporting placeholders for flexible argument injection. ```javascript function greet(greeting, punctuation) {   return greeting + ' ' + this.user + punctuation; }   var object = { 'user': 'fred' };   var bound = _.bind(greet, object, 'hi'); bound('!'); // => 'hi fred!'   // Bound with placeholders. var bound = _.bind(greet, object, _, '!'); bound('hi'); // => 'hi fred!' ``` -------------------------------- ### _.runInContext([context=root]) Source: https://lodash.com/docs Create a new pristine lodash function using the context object. ```APIDOC ## _.runInContext([context=root]) ### Description Create a new pristine `lodash` function using the `context` object. ### Arguments - **[context=root]** (Object) - Optional - The context object. ### Returns - **Function** - Returns a new `lodash` function. ``` -------------------------------- ### Retrieve values by path with _.at Source: https://lodash.com/docs Creates an array of values from an object based on the provided property paths. ```javascript var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };   _.at(object, ['a[0].b.c', 'a[1]']); // => [3, 4] ``` -------------------------------- ### _.conformsTo(object, source) Source: https://lodash.com/docs Checks if an object conforms to a source object by invoking predicate properties. ```APIDOC ## _.conformsTo(object, source) ### Description Checks if `object` conforms to `source` by invoking the predicate properties of `source` with the corresponding property values of `object`. ### Parameters - **object** (Object) - Required - The object to inspect. - **source** (Object) - Required - The object of property predicates to conform to. ### Returns - **(boolean)** - Returns `true` if `object` conforms, else `false`. ``` -------------------------------- ### Invoke multiple functions with _.over Source: https://lodash.com/docs Creates a function that invokes a list of iteratees with the provided arguments and returns their results as an array. ```javascript var func = _.over([Math.max, Math.min]);   func(1, 2, 3, 4); // => [4, 1] ```