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 _.eq

Overview

The lodash _.eq method is a utility function that performs a strict equality check between two values. It returns a Boolean value that indicates whether or not the two values are strictly equal.

The _.eq method ensures that the two values being compared have the same type and value. If they do, then the method returns true. Otherwise, it returns false.

This method is particularly useful when you want to compare two values in JavaScript but want to make sure that they are both of the same type. For example, when comparing two objects, you might want to make sure that they are both of the same type before performing any further operations on them.

Here's an example of how you might use the _.eq method to compare two values:

const value1 = 123;
const value2 = '123';

_.eq(value1, value2); // returns false

In this example, even though value1 and value2 both have the same value, they are not strictly equal because they are of different types (a number and a string, respectively). When we use the _.eq method to compare them, we get false as a result.

Here's another example, where we're comparing two objects:

const obj1 = { name: 'John', age: 30 };
const obj2 = { name: 'John', age: 30 };

_.eq(obj1, obj2); // returns false

In this example, even though obj1 and obj2 both have the same properties and values, they are not strictly equal because they are two different objects. When we use the _.eq method to compare them, we get false as a result.

The _.eq method can also be useful when you're working with other lodash methods that rely on strict equality checks, such as _.differenceWith, _.intersectionWith, and _.xorWith.

In summary, the lodash _.eq method is a simple utility function that performs a strict equality check between two values. It ensures that the two values are of the same type and value, and returns a Boolean value that indicates whether or not they are strictly equal.