EmptyBox type
Direct parent types
- Box
A box which might (FullBox) or might not (EmptyBox) contain a value. Box is somewhat similar to Arr of zero (EmptyBox) or exactly one (FullBox) element. This analogy helps understanding each() and filter() operation. Direct subtypes: 2
- NoData
Absence of data Direct subtypes: 2
Methods
- Bool(eb:EmptyBox) Source: stdlib.ngs:3738
Always false
- dflt(eb:EmptyBox, x:Any) Source: stdlib.ngs:3882
Wrap x in a Box Returns
FullBox with the value xExample
my_array = [10, 20] # dflt on FullBox has no effect my_array.Box(1).dflt(100).map(X*2).each(echo) # output: 40 # dflt on EmptyBox creates FullBox with the given value my_array.Box(5).dflt(100).map(X*2).each(echo) # HERE # output: 200
- each(eb:EmptyBox, cb:Fun) Source: stdlib.ngs:3762
Do nothing Returns
ebExample
Box(null).each(echo) # No output
- get(eb:EmptyBox) Source: stdlib.ngs:3797
Get EmptyBox value. Always throws BoxFail.
- get(eb:EmptyBox, dflt:Any) Source: stdlib.ngs:3803
Get EmptyBox value Returns
dflt
- JsonData(eb:EmptyBox) Source: stdlib.ngs:3905
Convert EmptyBox into JSON compatible data structure - null
- len(eb:EmptyBox) Source: stdlib.ngs:3813
Length of EmptyBox Returns
0
- map(eb:EmptyBox, mapper:Fun) Source: stdlib.ngs:3752
Do nothing Returns
ebExample
EmptyBox().map(X*2) # <EmptyBox>