Comparing version 0.0.3 to 0.0.4
@@ -13,7 +13,7 @@ export interface Const<T> { | ||
} | ||
export interface GroupBy<T> { | ||
export interface GroupBy<T, K, V> { | ||
readonly type: "groupBy"; | ||
readonly input: Bag<T>; | ||
readonly getKey: (v: T) => string; | ||
readonly reduce: (a: T, b: T) => T; | ||
readonly input: Bag<[K, V]>; | ||
readonly reduce: (a: V, b: V) => V; | ||
readonly flatMap: (v: [K, V]) => Iterable<T>; | ||
} | ||
@@ -30,8 +30,8 @@ export interface Product<T, A, B> { | ||
} | ||
export declare type Bag<T> = Const<T> | ExternalInput<T> | FlatMap<T, any> | GroupBy<T> | Product<T, any, any> | Merge<T>; | ||
export declare type Bag<T> = Const<T> | ExternalInput<T> | FlatMap<T, any> | GroupBy<T, any, any> | Product<T, any, any> | Merge<T>; | ||
export declare function const_<T>(value: T): Const<T>; | ||
export declare function externalInput<T>(): ExternalInput<T>; | ||
export declare function flatMap<T, I>(input: Bag<I>, func: (v: I) => Iterable<T>): FlatMap<T, I>; | ||
export declare function groupBy<T>(input: Bag<T>, getKey: (v: T) => string, reduce: (a: T, b: T) => T): GroupBy<T>; | ||
export declare function groupBy<T, K, V>(input: Bag<[K, V]>, reduce: (a: V, b: V) => V, flatMap: (v: [K, V]) => Iterable<T>): GroupBy<T, K, V>; | ||
export declare function product<T, A, B>(inputA: Bag<A>, inputB: Bag<B>, func: (a: A, b: B) => Iterable<T>): Product<T, A, B>; | ||
export declare function merge<T>(input: Bag<T>[]): Merge<T>; |
@@ -22,8 +22,8 @@ "use strict"; | ||
exports.flatMap = flatMap; | ||
function groupBy(input, getKey, reduce) { | ||
function groupBy(input, reduce, flatMap) { | ||
return { | ||
type: "groupBy", | ||
input: input, | ||
getKey: getKey, | ||
reduce: reduce, | ||
flatMap: flatMap | ||
}; | ||
@@ -30,0 +30,0 @@ } |
{ | ||
"name": "aliq", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "ALIQ (Abstract Language Integrated Query) for JavaScript and TypeScript", | ||
@@ -8,2 +8,3 @@ "main": "index.js", | ||
"tsc": "tsc", | ||
"prepare": "tsc", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
@@ -10,0 +11,0 @@ }, |
14886