-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathExtensions.fs
More file actions
22 lines (17 loc) · 745 Bytes
/
Copy pathExtensions.fs
File metadata and controls
22 lines (17 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
namespace RSXmlCombiner.FuncUI
open System
[<RequireQualifiedAccess>]
module Option =
/// If the predicate evaluates to true, return Some x, else None.
let create pred x = if pred x then Some x else None
/// If the string is null or whitespace, returns None.
let ofString s = if String.IsNullOrWhiteSpace(s) then None else Some s
[<RequireQualifiedAccess>]
module String =
/// Returns true if the given string is not null or an empty string.
let notEmpty = String.IsNullOrEmpty >> not
[<RequireQualifiedAccess>]
module List =
/// Returns a new list with the map function applied to the item at the given index.
let mapAt index map list =
List.mapi (fun i x -> if i = index then map x else x) list