orgnote-api 0.19.2 → 0.19.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,12 @@ export interface FileInfo {
9
9
  mtime: number;
10
10
  uri?: string;
11
11
  }
12
+ export declare class ErrorDirectoryNotFound extends Error {
13
+ constructor(path: string);
14
+ }
15
+ export declare class ErrorFileNotFound extends Error {
16
+ constructor(path: string);
17
+ }
12
18
  export interface FileSystem {
13
19
  readFile: <T extends 'utf8' | 'binary' = 'utf8', R = T extends 'utf8' ? string : Uint8Array>(path: string, encoding?: T) => Promise<R>;
14
20
  writeFile: (path: string, content: string | Uint8Array, encoding?: BufferEncoding) => Promise<void>;
@@ -1 +1,10 @@
1
- export {};
1
+ export class ErrorDirectoryNotFound extends Error {
2
+ constructor(path) {
3
+ super(`Directory not found: ${path}`);
4
+ }
5
+ }
6
+ export class ErrorFileNotFound extends Error {
7
+ constructor(path) {
8
+ super(`File not found: ${path}`);
9
+ }
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orgnote-api",
3
- "version": "0.19.2",
3
+ "version": "0.19.4",
4
4
  "description": "Official API for creating extensions for OrgNote app",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -17,3 +17,8 @@ test('Should not take slashes from the path array into account.', () => {
17
17
  const result = join(...path);
18
18
  expect(result).toBe('this/is-path/qwe');
19
19
  });
20
+ test('Should not join empty string with additional slash', () => {
21
+ const path = ['', 'file'];
22
+ const result = join(...path);
23
+ expect(result).toBe('file');
24
+ });
@@ -1,6 +1,6 @@
1
1
  export function join(...path) {
2
2
  return path
3
- .filter((p) => p !== '/')
3
+ .filter((p) => p !== '/' && p)
4
4
  .join('/')
5
5
  .replace(/\/+/g, '/')
6
6
  .replace(/\/+$/, '');