Skip to content

Commit 4a21a46

Browse files
style(auto): format all supported code with prettier (#143)
This commit fixes the style issues introduced in 34fdb2a according to the output from prettier. Details: https://deepsource.io/gh/openinf/util-object/transform/cbebf681-0853-4c36-8d29-c8d47d0f641f/ Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
1 parent 34fdb2a commit 4a21a46

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

src/index.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const map = <T>(opt_initial: T | null | undefined): object => {
3939

4040
// FIXME(@DerekNonGeneric): Should we be creating objects w/ null protos?
4141
return { ...opt_initial };
42-
}
42+
};
4343

4444
/**
4545
* Checks if the given key is a property in the map.
@@ -50,7 +50,7 @@ export const map = <T>(opt_initial: T | null | undefined): object => {
5050
*/
5151
export const hasOwn = <T>(object: T, key: string): boolean => {
5252
return _hasOwn.call(object, key);
53-
}
53+
};
5454

5555
/**
5656
* Returns obj[key] iff key is obj's own property (is not inherited).
@@ -61,17 +61,17 @@ export const hasOwn = <T>(object: T, key: string): boolean => {
6161
*/
6262
export const ownProperty = (
6363
object: Record<string, number | RegExp>,
64-
key: string,
64+
key: string
6565
): unknown => {
6666
return hasOwn(object, key) ? Reflect.get(object, key) : undefined;
67-
}
67+
};
6868

6969
/** @typedef {{t: object, s: object, d: number}} DeepMergeTuple */
7070
type DeepMergeTuple = {
7171
t: object;
7272
s: object;
7373
d: number;
74-
}
74+
};
7575

7676
/**
7777
* Deep merges source into target.
@@ -84,7 +84,11 @@ type DeepMergeTuple = {
8484
* @throws {Error} If source contains a circular reference.
8585
* Note: Only nested objects are deep-merged, primitives and arrays are not.
8686
*/
87-
export const deepMerge = (target: object, source: object, depth = 10): object => {
87+
export const deepMerge = (
88+
target: object,
89+
source: object,
90+
depth = 10
91+
): object => {
8892
// Keep track of seen objects to detect recursive references.
8993
/** @type {!object[]} */
9094
const seen: object[] = [];
@@ -122,7 +126,7 @@ export const deepMerge = (target: object, source: object, depth = 10): object =>
122126
}
123127
}
124128
return target;
125-
}
129+
};
126130

127131
/**
128132
* @param {!Record<string, number | RegExp> | null | undefined} o1
@@ -148,7 +152,7 @@ export const objectsEqualShallow = (
148152
}
149153
}
150154
return true;
151-
}
155+
};
152156

153157
/**
154158
* Takes an object, a property name, and a factory function. If the value of
@@ -165,12 +169,12 @@ export const objectsEqualShallow = (
165169
export const memo = <T extends object, P extends keyof T>(
166170
object: T,
167171
property: P,
168-
factory: (argument0: T, argument1: P) => T[P],
172+
factory: (argument0: T, argument1: P) => T[P]
169173
): T[P] => {
170174
let result = Reflect.get(object, property);
171175
if (result === undefined) {
172176
result = factory(object, property);
173177
Reflect.set(object, property, result);
174178
}
175179
return result;
176-
}
180+
};

0 commit comments

Comments
 (0)