|
3 | 3 | import {isFunction, isString, isArray, isRegExp, isDate} from "./predicates"; |
4 | 4 | import { all, pattern, any, not, prop, curry, val } from "./hof"; |
5 | 5 |
|
6 | | -let angular = (<any> window).angular; |
7 | | -export const fromJson = angular && angular.fromJson || _fromJson; |
8 | | -export const toJson = angular && angular.toJson || _toJson; |
9 | | -export const copy = angular && angular.copy || _copy; |
10 | | -export const forEach = angular && angular.forEach || _forEach; |
11 | | -export const extend = angular && angular.extend || _extend; |
12 | | -export const equals = angular && angular.equals || _equals; |
| 6 | +let angular = (<any> window).angular || {}; |
| 7 | +export const fromJson = angular.fromJson || _fromJson; |
| 8 | +export const toJson = angular.toJson || _toJson; |
| 9 | +export const copy = angular.copy || _copy; |
| 10 | +export const forEach = angular.forEach || _forEach; |
| 11 | +export const extend = angular.extend || _extend; |
| 12 | +export const equals = angular.equals || _equals; |
13 | 13 | export const identity = (x) => x; |
14 | 14 | export const noop = () => undefined; |
15 | 15 |
|
16 | | -type Mapper<X, T> = (x: X, key?: (string|number)) => T; |
| 16 | +export type Mapper<X, T> = (x: X, key?: (string|number)) => T; |
17 | 17 | export interface TypedMap<T> { [key: string]: T; } |
18 | 18 | export type Predicate<X> = (X) => boolean; |
19 | 19 | export type IInjectable = (Function|any[]); |
@@ -570,3 +570,9 @@ function _arraysEq(a1, a2) { |
570 | 570 | if (a1.length !== a2.length) return false; |
571 | 571 | return arrayTuples(a1, a2).reduce((b, t) => b && _equals(t[0], t[1]), true); |
572 | 572 | } |
| 573 | +// |
| 574 | +//const _addToGroup = (result, keyFn) => (item) => |
| 575 | +// (result[keyFn(item)] = result[keyFn(item)] || []).push(item) && result; |
| 576 | +//const groupBy = (array, keyFn) => array.reduce((memo, item) => _addToGroup(memo, keyFn), {}); |
| 577 | +// |
| 578 | +// |
0 commit comments