Skip to content

fix: improved asymptotic of extend func from O(n^2) to o(n) #16

Merged
merged 1 commit into from
Dec 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libs/browser/src/lib/services/browser-micro-sentry-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { State } from '../models/state';
import { MicroSentryPlugin } from '../models/plugin';
import { BrowserSentryClientOptions } from '../models/browser-sentry-client-options';
import { isMatchingPattern } from '../utils/is-matching-pattern';
import { __assign } from 'tslib';

export class BrowserMicroSentryClient extends MicroSentryClient {
private destroyed = false;
Expand Down Expand Up @@ -233,16 +234,15 @@ export class BrowserMicroSentryClient extends MicroSentryClient {
? newStateValue
: null;

return {
...acc,
return __assign(acc, {
[key]:
stateArray || newStateArray
? [...(stateArray || []), ...(newStateArray || [])]
: {
...(typeof stateValue !== 'string' ? stateValue : {}),
...(typeof newStateValue !== 'string' ? newStateValue : {}),
},
};
});
},
{}
);
Expand Down
20 changes: 1 addition & 19 deletions libs/core/src/lib/service/micro-sentry-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,7 @@ import { SentryRequest } from '../models/models';
import { AUTH_HEADER, DSN_REGEXP } from '../consts/consts';
import { computeStackTrace } from '../helpers/compute-stack-trace';
import { SentryClientOptions } from '../models/sentry-client-options';

const __assign =
Object.assign ||
function __assign(target: Record<string, any>) {
const length = arguments.length;

for (let i = 1; i < length; i++) {
// eslint-disable-next-line prefer-rest-params
const source = arguments[i];

for (const property in source) {
if (Object.prototype.hasOwnProperty.call(source, property)) {
target[property] = source[property];
}
}
}

return target;
};
import { __assign } from 'tslib';

export class MicroSentryClient {
readonly authHeader?: string;
Expand Down