fp-ts-node
Advanced tools
Comparing version 2.0.0 to 2.1.0
/// <reference types="node" /> | ||
/** | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
@@ -12,3 +12,3 @@ import { readerTaskEither as RTE } from "fp-ts"; | ||
* @category Model | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
@@ -22,3 +22,3 @@ export declare type PathTaskEither<R extends fs.PathLike | number, A> = RTE.ReaderTaskEither<R, NodeJS.ErrnoException, A>; | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
@@ -39,3 +39,3 @@ export declare function access(mode?: number): PathTaskEither<fs.PathLike, void>; | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
@@ -49,3 +49,3 @@ export declare function appendFile(options?: fs.WriteFileOptions): (data: string | Uint8Array) => PathTaskEither<number | fs.PathLike, void>; | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
@@ -58,4 +58,12 @@ export declare function chmod(mode: fs.Mode): PathTaskEither<fs.PathLike, void>; | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
export declare function chown(uid: number, gid: number): PathTaskEither<fs.PathLike, void>; | ||
/** | ||
* Asynchronous close(2) - close a file descriptor. | ||
* @param fd A file descriptor. | ||
* | ||
* @category Constructors | ||
* @since 2.1.0 | ||
*/ | ||
export declare const close: PathTaskEither<number, void>; |
@@ -22,9 +22,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.chown = exports.chmod = exports.appendFile = exports.access = void 0; | ||
exports.close = exports.chown = exports.chmod = exports.appendFile = exports.access = void 0; | ||
/** | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
var fp_ts_1 = require("fp-ts"); | ||
var fs = __importStar(require("fs")); | ||
var _access = fp_ts_1.taskEither.taskify(fs.access); | ||
/** | ||
@@ -36,9 +35,10 @@ * Asynchronously tests a user's permissions for the file specified by path. | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
function access(mode) { | ||
return function (path) { return _access(path, mode); }; | ||
return function (path) { | ||
return fp_ts_1.taskEither.taskify(fs.access)(path, mode); | ||
}; | ||
} | ||
exports.access = access; | ||
var _appendFile = fp_ts_1.taskEither.taskify(fs.appendFile); | ||
/** | ||
@@ -57,3 +57,3 @@ * Asynchronously append data to a file, creating the file if it does not exist. | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
@@ -64,3 +64,3 @@ function appendFile(options) { | ||
return function (path) { | ||
return _appendFile(path, data, options); | ||
return fp_ts_1.taskEither.taskify(fs.appendFile)(path, data, options); | ||
}; | ||
@@ -70,3 +70,2 @@ }; | ||
exports.appendFile = appendFile; | ||
var _chmod = fp_ts_1.taskEither.taskify(fs.chmod); | ||
/** | ||
@@ -78,9 +77,10 @@ * Asynchronous chmod(2) - Change permissions of a file. | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
function chmod(mode) { | ||
return function (path) { return _chmod(path, mode); }; | ||
return function (path) { | ||
return fp_ts_1.taskEither.taskify(fs.chmod)(path, mode); | ||
}; | ||
} | ||
exports.chmod = chmod; | ||
var _chown = fp_ts_1.taskEither.taskify(fs.chown); | ||
/** | ||
@@ -91,7 +91,17 @@ * Asynchronous chown(2) - Change ownership of a file. | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
function chown(uid, gid) { | ||
return function (path) { return _chown(path, uid, gid); }; | ||
return function (path) { | ||
return fp_ts_1.taskEither.taskify(fs.chown)(path, uid, gid); | ||
}; | ||
} | ||
exports.chown = chown; | ||
/** | ||
* Asynchronous close(2) - close a file descriptor. | ||
* @param fd A file descriptor. | ||
* | ||
* @category Constructors | ||
* @since 2.1.0 | ||
*/ | ||
exports.close = fp_ts_1.taskEither.taskify(fs.close); |
@@ -1,7 +0,1 @@ | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export * as fs from "./fs"; |
@@ -23,8 +23,2 @@ "use strict"; | ||
exports.fs = void 0; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
exports.fs = __importStar(require("./fs")); |
/// <reference types="node" /> | ||
/** | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
@@ -12,3 +12,3 @@ import { readerTaskEither as RTE } from "fp-ts"; | ||
* @category Model | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
@@ -22,3 +22,3 @@ export declare type PathTaskEither<R extends fs.PathLike | number, A> = RTE.ReaderTaskEither<R, NodeJS.ErrnoException, A>; | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
@@ -39,3 +39,3 @@ export declare function access(mode?: number): PathTaskEither<fs.PathLike, void>; | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
@@ -49,3 +49,3 @@ export declare function appendFile(options?: fs.WriteFileOptions): (data: string | Uint8Array) => PathTaskEither<number | fs.PathLike, void>; | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
@@ -58,4 +58,12 @@ export declare function chmod(mode: fs.Mode): PathTaskEither<fs.PathLike, void>; | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
export declare function chown(uid: number, gid: number): PathTaskEither<fs.PathLike, void>; | ||
/** | ||
* Asynchronous close(2) - close a file descriptor. | ||
* @param fd A file descriptor. | ||
* | ||
* @category Constructors | ||
* @since 2.1.0 | ||
*/ | ||
export declare const close: PathTaskEither<number, void>; |
/** | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
import { taskEither as TE } from "fp-ts"; | ||
import * as fs from "fs"; | ||
const _access = TE.taskify(fs.access); | ||
/** | ||
@@ -13,8 +12,7 @@ * Asynchronously tests a user's permissions for the file specified by path. | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
export function access(mode) { | ||
return (path) => _access(path, mode); | ||
return (path) => TE.taskify(fs.access)(path, mode); | ||
} | ||
const _appendFile = TE.taskify(fs.appendFile); | ||
/** | ||
@@ -33,8 +31,7 @@ * Asynchronously append data to a file, creating the file if it does not exist. | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
export function appendFile(options = {}) { | ||
return (data) => (path) => _appendFile(path, data, options); | ||
return (data) => (path) => TE.taskify(fs.appendFile)(path, data, options); | ||
} | ||
const _chmod = TE.taskify(fs.chmod); | ||
/** | ||
@@ -46,8 +43,7 @@ * Asynchronous chmod(2) - Change permissions of a file. | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
export function chmod(mode) { | ||
return (path) => _chmod(path, mode); | ||
return (path) => TE.taskify(fs.chmod)(path, mode); | ||
} | ||
const _chown = TE.taskify(fs.chown); | ||
/** | ||
@@ -58,6 +54,14 @@ * Asynchronous chown(2) - Change ownership of a file. | ||
* @category Constructors | ||
* @since 1.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
export function chown(uid, gid) { | ||
return (path) => _chown(path, uid, gid); | ||
return (path) => TE.taskify(fs.chown)(path, uid, gid); | ||
} | ||
/** | ||
* Asynchronous close(2) - close a file descriptor. | ||
* @param fd A file descriptor. | ||
* | ||
* @category Constructors | ||
* @since 2.1.0 | ||
*/ | ||
export const close = TE.taskify(fs.close); |
@@ -1,7 +0,1 @@ | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export * as fs from "./fs"; |
{ | ||
"name": "fp-ts-node", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"files": [ | ||
@@ -54,4 +54,4 @@ "dist" | ||
{ | ||
"name": "beta", | ||
"prerelease": true | ||
"name": "latest", | ||
"prerelease": false | ||
} | ||
@@ -58,0 +58,0 @@ ], |
@@ -6,1 +6,14 @@ # fp-ts-node | ||
Currently only export `fs` module, but there's more to come. | ||
## Implied Defaults | ||
For the `fs` module, every API requires a path. Most API's can take options and some take data too. | ||
The order of functions are curried as follows where possible. Calls and parameters are removed where possible. | ||
```ts | ||
type OurFunction = ( | ||
...parameters: Array<unknown>, | ||
options?: {} | ||
) => (data: unknown) => ReaderTaskEither<fs.PathLike, NodeJS.ErrnoException, A>; | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28469
513
19