Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

8
LINES

< > BotCompany Repo | #1031522 // getBoolOpt - getOpt with optional cast to bool, defaulting to false

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (2794L) is out of date.

sbool getBoolOpt(O o, S field, bool defaultValue default false) {
  ret getBoolOpt(field, o, defaultValue);
}

sbool mapMethodLike getBoolOpt(S field, O o, bool defaultValue default false) {
  O val = getOpt(o, field);
  ret defaultValue ? !eq(Bool.FALSE, val) : eq(Bool.TRUE, val);
}

Author comment

Began life as a copy of #1021916

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031522
Snippet name: getBoolOpt - getOpt with optional cast to bool, defaulting to false
Eternal ID of this version: #1031522/6
Text MD5: cca05f866c50188efffdfc3af7ea2738
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-22 05:00:17
Source code size: 291 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 203 / 274
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)