Home > @easyops-cn/brick-next-pipes > equal
equal() function
比较两个值是否相同(深度比较)。
Logic
Signature:
export declare function equal(value: unknown, other: unknown): boolean;
Parameters
| Parameter | Type | Description |
|---|---|---|
| value | unknown | 被比较的值。 |
| other | unknown | 比较值。 |
Returns:
boolean
如果两者相同返回 true,否则返回 false。
Remarks
透传调用 _.isEqual。
**Note:** This method supports comparing arrays, array buffers, booleans, date objects, error objects, maps, numbers, Object objects, regexes, sets, strings, symbols, and typed arrays. Object objects are compared by their own, not inherited, enumerable properties. Functions and DOM nodes are **not** supported.
Example
let object = { 'user': 'fred' };
let other = { 'user': 'fred' };
equal(object, other);
// => true
object === other;
// => false