Skip to content

Commit

Permalink
Implement container helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
NoelDeMartin committed Mar 8, 2024
1 parent 00ca718 commit 775fe87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/models/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { expandIRI } from '@noeldemartin/solid-utils';

import SolidContainer from '@/models/SolidContainer';
import type { SolidContainerConstructor, SolidModelConstructor } from '@/main';
import type { SolidModel } from '@/models/SolidModel';

export function isContainer(model: SolidModel): model is SolidContainer {
return model instanceof SolidContainer;
}

export function isContainerClass(modelClass: SolidModelConstructor): modelClass is SolidContainerConstructor {
return modelClass.rdfsClasses.includes(expandIRI('ldp:Container'));
}
1 change: 1 addition & 0 deletions src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type ManagesPermissions from './mixins/ManagesPermissions';
import type SerializesToJsonLD from './mixins/SerializesToJsonLD';
import type { PermissionsTracker } from './mixins/ManagesPermissions';

export * from './helpers';
export * from './history/index';
export * from './inference';
export * from './relations/index';
Expand Down

0 comments on commit 775fe87

Please sign in to comment.