Example #1
0
  transform(tasks: List<Task>): List<string> {
     const owners = tasks.reduce((result, task) =>
       result.includes(task.owner) ? 
       result : result.push(task.owner), 
     List<string>());

    return owners;
  }
Example #2
0
 process(rawData: RawTableData): TableData {
   const data = (rawData instanceof Iterable)
              ? rawData as Iterable<number, any>
              : Seq(rawData)
   return this.plugins.reduce(
     (result, plugin) => plugin.process(result, this.columns),
     data
   )
 }
    getValue(): number {
        let totalValueOfPrescriptions = this.prescriptions.reduce(
            (acc, prescription) => acc + prescription.value,
            0
        );

        if (this.isGrantedLimitExemption) {
            return totalValueOfPrescriptions;
        }

        return Math.min(totalValueOfPrescriptions, 30);
    }
Example #4
0
    const sorted = tableData.sort((row1, row2) => {
      const reducer = (result: number, sorter: TableSorter) => {
        const { selector, comparator } = sorter
        const order = this.getSortOrder(sorter.order)
        const factor = order === DESC ? -1 : 1

        return result !== 0
          ? result
          : comparator(selector(row1), selector(row2)) * factor
      }
      return sorters.reduce(reducer, 0)
    })
function sum_list(list: List<number>): number {
    return list.reduce((acc: number, n: number) => acc + n, 0);
}