@sapphire/result
Advanced tools
Comparing version 2.6.7-next.5873dace.0 to 2.6.7-next.5ac3f246
@@ -7,6 +7,3 @@ var SapphireResult = (function (exports) { | ||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
var __publicField = (obj, key, value) => { | ||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
return value; | ||
}; | ||
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
@@ -133,4 +130,4 @@ // src/lib/common/utils.ts | ||
return this.value.match({ | ||
some: (value) => createSome(createOk(value)), | ||
none: () => createNone | ||
some: /* @__PURE__ */ __name((value) => createSome(createOk(value)), "some"), | ||
none: /* @__PURE__ */ __name(() => createNone, "none") | ||
}); | ||
@@ -259,4 +256,4 @@ } | ||
return this.value.match({ | ||
ok: (v) => createOk(createSome(v)), | ||
err: (e) => createErr(e) | ||
ok: /* @__PURE__ */ __name((v) => createOk(createSome(v)), "ok"), | ||
err: /* @__PURE__ */ __name((e) => createErr(e), "err") | ||
}); | ||
@@ -538,6 +535,4 @@ } | ||
function resolve(value) { | ||
if (value === null || value === void 0) | ||
return Option2.none; | ||
if (is(value)) | ||
return value; | ||
if (value === null || value === void 0) return Option2.none; | ||
if (is(value)) return value; | ||
return (0, Option2.some)(value); | ||
@@ -552,4 +547,3 @@ } | ||
function from(op) { | ||
if (!isFunction(op)) | ||
return resolve(op); | ||
if (!isFunction(op)) return resolve(op); | ||
try { | ||
@@ -602,4 +596,3 @@ return resolve(op()); | ||
function resolve(value) { | ||
if (is(value)) | ||
return value; | ||
if (is(value)) return value; | ||
return (0, Result2.ok)(value); | ||
@@ -614,4 +607,3 @@ } | ||
function from(op) { | ||
if (!isFunction(op)) | ||
return resolve(op); | ||
if (!isFunction(op)) return resolve(op); | ||
try { | ||
@@ -672,3 +664,3 @@ return resolve(op()); | ||
})({}); | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.global.js.map | ||
//# sourceMappingURL=index.global.js.map |
{ | ||
"name": "@sapphire/result", | ||
"version": "2.6.7-next.5873dace.0", | ||
"version": "2.6.7-next.5ac3f246", | ||
"description": "A TypeScript port of Nightly Rust's Result and Option structs", | ||
@@ -28,8 +28,9 @@ "author": "@sapphire", | ||
"lint": "eslint src tests --ext ts --fix -c ../../.eslintrc", | ||
"build": "tsup && yarn build:rename-cjs-index", | ||
"build:rename-cjs-index": "tsx --tsconfig ../../scripts/tsconfig.json ../../scripts/rename-cjs-index.cts", | ||
"build": "yarn gen-index && tsup && yarn build:rename-cjs-index", | ||
"build:rename-cjs-index": "tsx ../../scripts/rename-cjs-index.cts", | ||
"docs": "typedoc-json-parser", | ||
"prepack": "yarn build", | ||
"bump": "cliff-jumper", | ||
"check-update": "cliff-jumper --dry-run" | ||
"check-update": "cliff-jumper --dry-run", | ||
"gen-index": "tsx ../../scripts/gen-index.cts result --write" | ||
}, | ||
@@ -69,11 +70,11 @@ "repository": { | ||
"devDependencies": { | ||
"@favware/cliff-jumper": "^3.0.3", | ||
"@vitest/coverage-v8": "^1.5.2", | ||
"tsup": "^8.0.2", | ||
"tsx": "^4.7.3", | ||
"@favware/cliff-jumper": "^5.0.0", | ||
"@vitest/coverage-v8": "^2.1.3", | ||
"tsup": "^8.3.0", | ||
"tsx": "^4.19.1", | ||
"typedoc": "^0.25.13", | ||
"typedoc-json-parser": "^9.0.1", | ||
"typescript": "^5.4.5", | ||
"vitest": "^1.5.2" | ||
"typedoc-json-parser": "^10.0.0", | ||
"typescript": "~5.4.5", | ||
"vitest": "^2.1.3" | ||
} | ||
} |
@@ -10,3 +10,2 @@ <div align="center"> | ||
[](https://github.com/sapphiredev/utilities/blob/main/LICENSE.md) | ||
[](https://codecov.io/gh/sapphiredev/utilities) | ||
[](https://bundlephobia.com/result?p=@sapphire/result) | ||
@@ -41,3 +40,3 @@ [](https://www.npmjs.com/package/@sapphire/result) | ||
**Note 2:** For more thorough examples check out the generated documentation on [our website here](https://www.sapphirejs.dev/docs/Documentation/api-utilities/interfaces/sapphire_result.IResult) | ||
**Note 2:** For more thorough examples check out the generated documentation on [our website here](https://www.sapphirejs.dev/docs/Documentation/api-utilities/@sapphire/result/interfaces/IResult) | ||
@@ -44,0 +43,0 @@ ### Wrapping synchronous `try-catch` blocks |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
319034
1920
127