@zelgadis87/utils-core 4.11.2 → 4.12.1
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 +16 -2
- package/esbuild/index.cjs.map +2 -2
- package/esbuild/index.mjs +16 -2
- package/esbuild/index.mjs.map +2 -2
- package/package.json +1 -1
- package/src/Optional.ts +24 -7
package/esbuild/index.mjs
CHANGED
|
@@ -2115,13 +2115,27 @@ var Optional = class _Optional {
|
|
|
2115
2115
|
}
|
|
2116
2116
|
}
|
|
2117
2117
|
orElse(newValue) {
|
|
2118
|
+
if (this.isPresent()) {
|
|
2119
|
+
return this._value;
|
|
2120
|
+
} else {
|
|
2121
|
+
return newValue;
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
orElseGet(newValueProducer) {
|
|
2125
|
+
if (this.isPresent()) {
|
|
2126
|
+
return this._value;
|
|
2127
|
+
} else {
|
|
2128
|
+
return newValueProducer();
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
orElseNullable(newValue) {
|
|
2118
2132
|
if (this.isEmpty())
|
|
2119
2133
|
return _Optional.ofNullable(newValue);
|
|
2120
2134
|
return this;
|
|
2121
2135
|
}
|
|
2122
|
-
|
|
2136
|
+
orElseGetNullable(newValueProducer) {
|
|
2123
2137
|
if (this.isEmpty()) {
|
|
2124
|
-
const newValue =
|
|
2138
|
+
const newValue = newValueProducer();
|
|
2125
2139
|
return _Optional.ofNullable(newValue);
|
|
2126
2140
|
}
|
|
2127
2141
|
return this;
|