Skip to content

Commit

Permalink
export as default
Browse files Browse the repository at this point in the history
  • Loading branch information
AmauryD committed Nov 26, 2023
1 parent 231e90c commit b6c2f57
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
9 changes: 5 additions & 4 deletions ember-immer-changeset/src/changeset/immer-changeset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import type {
ValidationError,
ValidationFunction,
} from '../types/changeset';
import { aggregatedLastChanges } from '../utils/get-last-versions';
import aggregatedLastChanges from '../utils/get-last-versions';
import {
ChangesetEventEmitter,
default as ChangesetEventEmitter,
type OnSetCallback,
} from '../utils/event-emitter';

Expand All @@ -26,8 +26,9 @@ enablePatches();
* It uses Immer to create a draft of the data object and track changes made to it.
* The changes can be applied, reverted, validated, and saved.
*/
export class ImmerChangeset<T extends Record<string, any> = Record<string, any>>
implements Changeset<T>
export default class ImmerChangeset<
T extends Record<string, any> = Record<string, any>,
> implements Changeset<T>
{
/**
* The data object.
Expand Down
2 changes: 1 addition & 1 deletion ember-immer-changeset/src/helpers/changeset-get.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { helper } from '@ember/component/helper';
import { ImmerChangeset } from '..';
import type ImmerChangeset from '../changeset/immer-changeset';

function changesetGet([changeset, key]: [ImmerChangeset | undefined, string]) {
return changeset?.get(key);
Expand Down
9 changes: 6 additions & 3 deletions ember-immer-changeset/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export * from './types/changeset';
export * from './changeset/immer-changeset';
export * from './utils/is-changeset';
export * from './helpers/changeset-get';
import ImmerChangeset from './changeset/immer-changeset';
import { default as isChangeset } from './utils/is-changeset';
import { default as changesetGet } from './helpers/changeset-get';

export default ImmerChangeset;
export { isChangeset, changesetGet, ImmerChangeset };
4 changes: 2 additions & 2 deletions ember-immer-changeset/src/utils/event-emitter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { StringKeyOf } from 'type-fest';
import { ImmerChangeset } from '..';
import type ImmerChangeset from '../changeset/immer-changeset';

export type OnSetCallback<
T extends ImmerChangeset,
Expand All @@ -16,7 +16,7 @@ type MapValue<
K extends StringKeyOf<EventMap<T, DTO>>,
> = EventMap<T, DTO>[K] extends Map<Symbol, infer Callback> ? Callback : never;

export class ChangesetEventEmitter<
export default class ChangesetEventEmitter<
T extends ImmerChangeset,
DTO extends Record<string, any>,
> {
Expand Down
2 changes: 1 addition & 1 deletion ember-immer-changeset/src/utils/get-last-versions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Change } from '../types/changeset';

export function aggregatedLastChanges(arr: Change[]) {
export default function aggregatedLastChanges(arr: Change[]) {
const result: Change[] = [];

arr.forEach((item) => {
Expand Down
4 changes: 2 additions & 2 deletions ember-immer-changeset/src/utils/is-changeset.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ImmerChangeset } from '../changeset/immer-changeset';
import ImmerChangeset from '../changeset/immer-changeset';

export function isChangeset(obj?: InstanceType<any>) {
export default function isChangeset(obj?: InstanceType<any>) {
if (!obj) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion test-app/tests/unit/utils/is-changeset-test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ImmerChangeset } from 'ember-immer-changeset';
import { isChangeset } from 'ember-immer-changeset/utils/is-changeset';
import isChangeset from 'ember-immer-changeset/utils/is-changeset';
import { module, test } from 'qunit';

module('Unit | Utility | is-changeset', function () {
Expand Down

0 comments on commit b6c2f57

Please sign in to comment.