@trayio/commons
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -0,1 +1,2 @@ | ||
import * as TE from 'fp-ts/TaskEither'; | ||
import * as E from 'fp-ts/Either'; | ||
@@ -12,2 +13,3 @@ import * as t from 'io-ts'; | ||
writeToFile: (path: string, value: DynamicType) => E.Either<Error, undefined>; | ||
writeToFileAsync: (path: string, value: DynamicType) => TE.TaskEither<Error, undefined>; | ||
safeCast: <T>(dynamicType: DynamicType, codec: Codec<T>) => E.Either<Error, T>; | ||
@@ -14,0 +16,0 @@ } |
@@ -27,3 +27,5 @@ "use strict"; | ||
exports.dynamicArrayTypeDescriptor = exports.dynamicObjectTypeDescriptor = exports.dynamicTypeDescriptor = exports.DynamicType = void 0; | ||
const TE = __importStar(require("fp-ts/TaskEither")); | ||
const fs = __importStar(require("fs")); | ||
const fse = __importStar(require("fs-extra")); | ||
const E = __importStar(require("fp-ts/Either")); | ||
@@ -36,2 +38,3 @@ const function_1 = require("fp-ts/function"); | ||
writeToFile: (path, value) => (0, function_1.pipe)((0, Try_1.tryToEither)(() => fs.writeFileSync(path, JSON.stringify(value))), E.map(() => undefined)), | ||
writeToFileAsync: (path, value) => (0, function_1.pipe)(TE.tryCatch(() => fse.writeFile(path, JSON.stringify(value)), (err) => new Error(err.message)), TE.map(() => undefined)), | ||
safeCast: (dynamicType, codec) => codec.decode(dynamicType), | ||
@@ -38,0 +41,0 @@ }; |
{ | ||
"name": "@trayio/commons", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Extensions to the standard/core libraries and basic features", | ||
@@ -5,0 +5,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
104990
1900
4