@zelgadis87/utils-core 4.11.2 → 4.12.0
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/dist/Optional.d.ts +8 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/esbuild/index.cjs +14 -2
- package/esbuild/index.cjs.map +2 -2
- package/esbuild/index.mjs +14 -2
- package/esbuild/index.mjs.map +2 -2
- package/package.json +1 -1
- package/src/Optional.ts +21 -5
package/esbuild/index.mjs
CHANGED
|
@@ -2115,13 +2115,25 @@ var Optional = class _Optional {
|
|
|
2115
2115
|
}
|
|
2116
2116
|
}
|
|
2117
2117
|
orElse(newValue) {
|
|
2118
|
+
if (this.isEmpty())
|
|
2119
|
+
return _Optional.of(newValue);
|
|
2120
|
+
return this;
|
|
2121
|
+
}
|
|
2122
|
+
orElseGet(newValueProducer) {
|
|
2123
|
+
if (this.isEmpty()) {
|
|
2124
|
+
const newValue = newValueProducer();
|
|
2125
|
+
return _Optional.of(newValue);
|
|
2126
|
+
}
|
|
2127
|
+
return this;
|
|
2128
|
+
}
|
|
2129
|
+
orElseNullable(newValue) {
|
|
2118
2130
|
if (this.isEmpty())
|
|
2119
2131
|
return _Optional.ofNullable(newValue);
|
|
2120
2132
|
return this;
|
|
2121
2133
|
}
|
|
2122
|
-
|
|
2134
|
+
orElseGetNullable(newValueProducer) {
|
|
2123
2135
|
if (this.isEmpty()) {
|
|
2124
|
-
const newValue =
|
|
2136
|
+
const newValue = newValueProducer();
|
|
2125
2137
|
return _Optional.ofNullable(newValue);
|
|
2126
2138
|
}
|
|
2127
2139
|
return this;
|