lib/Obj.ps1
using namespace Microsoft.VisualBasic function Dft ($v,$dft){if(Is-Empty $v){$dft}else{$v}} function Is-Empty ($s) {if([System.String]::IsNullOrEmpty($s)){$true}else{-not((Trim $s)-match"\S+")}} function Is-NonEmpty($s) {-not(Is-Empty $s)} function Ty ($obj) {if($obj-eq $null){$null}else{$obj.GetType()}} function TyNm ($obj) {if($obj-eq $null){'$null'}else{($obj.GetType()).FullName} } function Switch-Itm {param($idx,[parameter(ValueFromRemainingArguments=$true)]$ap) $ap[$idx]} function Val ($obj) {[Conversion]::Val($obj)} function Is-Even ($n) {$n%=2;$n-eq 0} function Is-Odd ($n) {!(Is-Even $n)} |