add after ary assign assignIn assignInWith assignWith at before bind bindAll bindKey camelCase capitalize castArray ceil chain chunk clamp clone cloneDeep cloneDeepWith cloneWith compact concat conformsTo countBy create curry curryRight debounce deburr defaults defaultsDeep defer delay difference divide drop dropRight each eachRight endsWith entries entriesIn eq escape every extend extendWith fill filter find findIndex findKey findLast findLastIndex findLastKey first flatMap flatMapDeep flatMapDepth flatten flattenDeep flattenDepth flip floor forEach forEachRight forIn forInRight forOwn forOwnRight fromPairs functions functionsIn get groupBy gt gte has hasIn head inRange includes indexOf initial intersection invert invertBy invoke invokeMap isArguments isArray isArrayBuffer isArrayLike isArrayLikeObject isBoolean isBuffer isDate isElement isEmpty isEqual isEqualWith isError isFinite isFunction isInteger isLength isMap isMatch isMatchWith isNaN isNative isNil isNull isNumber isObject isObjectLike isPlainObject isRegExp isSafeInteger isSet isString isSymbol isTypedArray isUndefined isWeakMap isWeakSet join kebabCase keyBy keys keysIn last lastIndexOf lowerCase lowerFirst lt lte map mapKeys mapValues max maxBy mean meanBy memoize merge mergeWith min minBy multiply negate nth omit omitBy once orderBy overArgs pad padEnd padStart parseInt partial partialRight partition pick pickBy pull pullAll pullAllBy pullAllWith pullAt random rearg reduce reduceRight reject remove repeat replace rest result reverse round sample sampleSize set setWith shuffle size slice snakeCase some sortBy sortedIndex sortedIndexOf sortedLastIndex sortedLastIndexOf sortedUniq split spread startCase startsWith subtract sum sumBy tail take takeRight tap template throttle thru toArray toFinite toInteger toLength toLower toNumber toPairs toPairsIn toPlainObject toSafeInteger toString toUpper transform trim trimEnd trimStart truncate unary unescape union uniq uniqBy uniqWith unset unzip unzipWith update updateWith upperCase upperFirst values valuesIn without words wrap wrapperAt wrapperChain wrapperCommit wrapperFlatMap wrapperLodash wrapperNext wrapperPlant wrapperReverse wrapperToIterator wrapperValue xor zip zipObject zipObjectDeep zipWith

Lodash _.values

Overview

Introduction:

Lodash is a popular JavaScript utility library used for a range of functions such as dealing with arrays, objects and strings. One of the widely used functions in this library is the _.values method that retrieves all the values of an object's properties in an array format.

Syntax:

The _.values method's syntax is:

_.values(object)

Parameters:

The method has only one parameter:

object: The object whose values will be extracted.

Return Value:

The method returns an array containing all the object's values.

Example:

const obj = { a: 1, b: 2, c: 3 }; _.values(obj); // Output: [1, 2, 3]

Description:

The _.values method is used to extract all the values of an object's properties and place them in an array. In other words, this method creates an array from an object's values.

The method can be applied to any object, which will result in the array of its values.

The order of values in the returned array depends on how the object's properties were defined in time.

It is important to note that the _.values method does not work on non-objects like strings or numbers.

Usage:

The _.values method can be useful when you need to access all the values in an object without having to iterate over the keys manually. This can help simplify code and make it easier to read.

The method can be used to create an array of object values for further processing or to return a part of an object's data in a specific format.

It is also helpful when working with object-oriented programming where objects' data needs to be analysed or manipulated extensively.

Conclusion:

In conclusion, the _.values method is an essential tool in the Lodash library that helps developers access and manipulate object data easily. The method's simplicity and effectiveness make it a must-have in any developer's toolkit.