@gesslar/toolkit 0.1.0 → 0.1.2
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.
- package/package.json +1 -1
- package/src/index.js +1 -1
- package/src/lib/Data.js +1 -1
- package/src/lib/FS.js +8 -0
- package/src/types/FS.d.ts +9 -0
- /package/src/lib/{Type.js → TypeSpec.js} +0 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -9,6 +9,6 @@ export {default as Data} from "./lib/Data.js"
|
|
|
9
9
|
export {default as Glog} from "./lib/Glog.js"
|
|
10
10
|
export {default as Sass} from "./lib/Sass.js"
|
|
11
11
|
export {default as Term} from "./lib/Term.js"
|
|
12
|
-
export {default as Type} from "./lib/
|
|
12
|
+
export {default as Type} from "./lib/TypeSpec.js"
|
|
13
13
|
export {default as Util} from "./lib/Util.js"
|
|
14
14
|
export {default as Valid} from "./lib/Valid.js"
|
package/src/lib/Data.js
CHANGED
package/src/lib/FS.js
CHANGED
|
@@ -8,7 +8,15 @@ import FileObject from "./FileObject.js"
|
|
|
8
8
|
import Sass from "./Sass.js"
|
|
9
9
|
import Valid from "./Valid.js"
|
|
10
10
|
|
|
11
|
+
const fdTypes = Object.freeze(["file", "directory"])
|
|
12
|
+
const upperFdTypes = Object.freeze(fdTypes.map(type => type.toUpperCase()))
|
|
13
|
+
const fdType = Object.freeze(await Data.allocateObject(upperFdTypes, fdTypes))
|
|
14
|
+
|
|
11
15
|
export default class FS {
|
|
16
|
+
static fdTypes = fdTypes
|
|
17
|
+
static upperFdTypes = upperFdTypes
|
|
18
|
+
static fdType = fdType
|
|
19
|
+
|
|
12
20
|
/**
|
|
13
21
|
* Fix slashes in a path
|
|
14
22
|
*
|
package/src/types/FS.d.ts
CHANGED
|
@@ -8,6 +8,15 @@ import DirectoryObject from './DirectoryObject.js'
|
|
|
8
8
|
* Base filesystem utilities class. FileObject and DirectoryObject extend this class.
|
|
9
9
|
*/
|
|
10
10
|
export default class FS {
|
|
11
|
+
/** Array of lowercase file descriptor types */
|
|
12
|
+
static readonly fdTypes: readonly ["file", "directory"]
|
|
13
|
+
|
|
14
|
+
/** Array of uppercase file descriptor types */
|
|
15
|
+
static readonly upperFdTypes: readonly ["FILE", "DIRECTORY"]
|
|
16
|
+
|
|
17
|
+
/** Mapping from uppercase to lowercase file descriptor types */
|
|
18
|
+
static readonly fdType: Readonly<Record<"FILE" | "DIRECTORY", "file" | "directory">>
|
|
19
|
+
|
|
11
20
|
/** Fix slashes in a path */
|
|
12
21
|
static fixSlashes(pathName: string): string
|
|
13
22
|
|
|
File without changes
|