change document to text and binary content
This commit is contained in:
14
packages/runtime/src/utils/utils.binary.ts
Normal file
14
packages/runtime/src/utils/utils.binary.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
const base64ToMaybeBuffer = (input?: string | null | Buffer) => {
|
||||
if (input === null) {
|
||||
return input;
|
||||
}
|
||||
if (!input) {
|
||||
return undefined;
|
||||
}
|
||||
if (typeof input === 'object') {
|
||||
return input;
|
||||
}
|
||||
return Buffer.from(input, 'base64');
|
||||
};
|
||||
|
||||
export { base64ToMaybeBuffer };
|
||||
@@ -1,9 +1,13 @@
|
||||
import deepEqual from 'deep-equal';
|
||||
|
||||
const compareObjectKeys = <T extends Record<string, unknown>>(a: T, b: T, keys: (keyof T)[]) => {
|
||||
const compareObjectKeys = <A extends Record<string, unknown>, B extends Record<string, unknown>>(
|
||||
a: A,
|
||||
b: B,
|
||||
keys: (keyof (A & B))[],
|
||||
) => {
|
||||
for (const key of keys) {
|
||||
const avalue = a[key];
|
||||
const bvalue = b[key];
|
||||
const avalue = a[key as keyof A];
|
||||
const bvalue = b[key as keyof B];
|
||||
if (!deepEqual(avalue, bvalue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user