Пример #1
0
 /// <summary>
 /// Removes any non-null values from the input list.
 /// </summary>
 /// <param name="list">An input list</param>
 /// <returns>Returns a list with null value removed</returns>
 /// <remarks>
 /// ```scriban-html
 /// {{ [1, null, 3] | array.compact }}
 /// ```
 /// ```html
 /// [1, 3]
 /// ```
 /// </remarks>
 public static IEnumerable Compact(IEnumerable list)
 {
     return(ScriptRange.Compact(list));
 }
Пример #2
0
 /// <summary>
 /// Returns the unique elements of the input `list`.
 /// </summary>
 /// <param name="list">The input list</param>
 /// <returns>A list of unique elements of the input `list`.</returns>
 /// <remarks>
 /// ```scriban-html
 /// {{ [1, 1, 4, 5, 8, 8] | array.uniq }}
 /// ```
 /// ```html
 /// [1, 4, 5, 8]
 /// ```
 /// </remarks>
 public static IEnumerable Uniq(IEnumerable list)
 {
     return(ScriptRange.Uniq(list));
 }
Пример #3
0
 /// <summary>
 /// Reverses the input `list`
 /// </summary>
 /// <param name="list">The input list</param>
 /// <returns>A new list in reversed order.</returns>
 /// <remarks>
 /// ```scriban-html
 /// {{ [4, 5, 6, 7] | array.reverse }}
 /// ```
 /// ```html
 /// [7, 6, 5, 4]
 /// ```
 /// </remarks>
 public static IEnumerable Reverse(IEnumerable list)
 {
     return(ScriptRange.Reverse(list));
 }
Пример #4
0
 /// <summary>
 /// Returns the remaining of the list after the specified offset
 /// </summary>
 /// <param name="list">The input list</param>
 /// <param name="index">The index of a list to return elements</param>
 /// <remarks>
 /// ```scriban-html
 /// {{ [4, 5, 6, 7, 8] | array.offset 2 }}
 /// ```
 /// ```html
 /// [6, 7, 8]
 /// ```
 /// </remarks>
 public static IEnumerable Offset(IEnumerable list, int index)
 {
     return(ScriptRange.Offset(list, index));
 }
Пример #5
0
 /// <summary>
 /// Returns a limited number of elments from the input list
 /// </summary>
 /// <param name="list">The input list</param>
 /// <param name="count">The number of elements to return from the input list</param>
 /// <remarks>
 /// ```scriban-html
 /// {{ [4, 5, 6] | array.limit 2 }}
 /// ```
 /// ```html
 /// [4, 5]
 /// ```
 /// </remarks>
 public static IEnumerable Limit(IEnumerable list, int count)
 {
     return(ScriptRange.Limit(list, count));
 }
Пример #6
0
 /// <summary>
 /// Concatenates two lists.
 /// </summary>
 /// <param name="list1">The 1st input list</param>
 /// <param name="list2">The 2nd input list</param>
 /// <returns>The concatenation of the two input lists</returns>
 /// <remarks>
 /// ```scriban-html
 /// {{ [1, 2, 3] | array.concat [4, 5] }}
 /// ```
 /// ```html
 /// [1, 2, 3, 4, 5]
 /// ```
 /// </remarks>
 public static IEnumerable Concat(IEnumerable list1, IEnumerable list2)
 {
     return(ScriptRange.Concat(list1, list2));
 }