@celo/base
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -15,4 +15,5 @@ export * from './account'; | ||
export * from './phoneNumbers'; | ||
export * from './result'; | ||
export * from './signatureUtils'; | ||
export * from './string'; | ||
export * from './task'; |
@@ -20,2 +20,3 @@ "use strict"; | ||
__export(require("./phoneNumbers")); | ||
__export(require("./result")); | ||
__export(require("./signatureUtils")); | ||
@@ -22,0 +23,0 @@ __export(require("./string")); |
@@ -22,1 +22,7 @@ export interface OkResult<TResult> { | ||
} | ||
export declare const JSONParseErrorType = "JsonParseError"; | ||
export declare class JSONParseError extends RootError<string> { | ||
readonly error: Error; | ||
constructor(error: Error); | ||
} | ||
export declare function parseJsonAsResult(data: string): OkResult<any> | ErrorResult<JSONParseError>; |
@@ -116,2 +116,23 @@ "use strict"; | ||
exports.RootError = RootError; | ||
exports.JSONParseErrorType = 'JsonParseError'; | ||
// tslint:disable-next-line:max-classes-per-file | ||
var JSONParseError = /** @class */ (function (_super) { | ||
__extends(JSONParseError, _super); | ||
function JSONParseError(error) { | ||
var _this = _super.call(this, exports.JSONParseErrorType) || this; | ||
_this.error = error; | ||
return _this; | ||
} | ||
return JSONParseError; | ||
}(RootError)); | ||
exports.JSONParseError = JSONParseError; | ||
function parseJsonAsResult(data) { | ||
try { | ||
return exports.Ok(JSON.parse(data)); | ||
} | ||
catch (error) { | ||
return exports.Err(new JSONParseError(error)); | ||
} | ||
} | ||
exports.parseJsonAsResult = parseJsonAsResult; | ||
//# sourceMappingURL=result.js.map |
{ | ||
"name": "@celo/base", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Celo base common utils, no dependencies", | ||
@@ -5,0 +5,0 @@ "author": "Celo", |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
178643
92
2729