Skip to content

Commit

Permalink
docs: Add return type to models.file.splitFilename
Browse files Browse the repository at this point in the history
  • Loading branch information
zatteo committed Nov 28, 2023
1 parent a4a70e5 commit 7495395
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
9 changes: 6 additions & 3 deletions docs/api/cozy-client/modules/models.file.md
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ But we want to exclude .txt and .md because the CozyUI Viewer can already show t

### splitFilename

**splitFilename**(`file`): `any`
**splitFilename**(`file`): `Object`

Returns base filename and extension

Expand All @@ -779,9 +779,12 @@ Returns base filename and extension

*Returns*

`any`
`Object`

{filename, extension}
| Name | Type |
| :------ | :------ |
| `extension` | `string` |
| `filename` | `string` |

*Defined in*

Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-client/src/models/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const FILENAME_WITH_EXTENSION_REGEX = /(.+)(\..*)$/
* Returns base filename and extension
*
* @param {import("../types").IOCozyFile} file An io.cozy.files
* @returns {object} {filename, extension}
* @returns {{filename: string, extension: string}}
*/
export const splitFilename = file => {
if (!isString(file.name)) throw new Error('file should have a name property')
Expand Down
5 changes: 4 additions & 1 deletion packages/cozy-client/types/models/file.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ export function ensureFilePath(file: object, parent: object): object;
*/
export function getParentFolderId(file: object): string | null;
export const ALBUMS_DOCTYPE: "io.cozy.photos.albums";
export function splitFilename(file: import("../types").IOCozyFile): object;
export function splitFilename(file: import("../types").IOCozyFile): {
filename: string;
extension: string;
};
export function isFile(file: import("../types").IOCozyFile): boolean;
export function isDirectory(file: import("../types").IOCozyFile): boolean;
export function isNote(file: import("../types").IOCozyFile): boolean;
Expand Down

0 comments on commit 7495395

Please sign in to comment.