Skip to content

Commit

Permalink
generate .flow type def for npm
Browse files Browse the repository at this point in the history
  • Loading branch information
clarketm committed May 17, 2018
1 parent 81ddb46 commit be6e55a
Show file tree
Hide file tree
Showing 12 changed files with 5,149 additions and 4,877 deletions.
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[ignore]
.*/node_modules/.*
./packages/generator-super
.*\.flow

[include]
./packages/.*/src/lib/.*\.js
Expand Down
2 changes: 1 addition & 1 deletion dist/super.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -3661,7 +3661,7 @@ var Trie = function () {
return Trie;
}();

var version = "0.0.3";
var version = "0.0.4";

var Super = {
version: version,
Expand Down
2 changes: 1 addition & 1 deletion dist/super.js
Original file line number Diff line number Diff line change
Expand Up @@ -3667,7 +3667,7 @@
return Trie;
}();

var version = "0.0.3";
var version = "0.0.4";

var Super = {
version: version,
Expand Down
200 changes: 200 additions & 0 deletions dist/super.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
declare export class Array extends Array<any> {

constructor (iterable?: Array<any>): void;
flatMap (callback: (value: any, index: number, array: Array<any>) => Array<any>): Array<any>;
flatten (depth?: number): Array<any>;
mergeSort (comparator: any): Array<any>;
}

declare export class BinaryTree {

_root: ?BinaryTreeNode;
get height (): number;
get root (): ?BinaryTreeNode;
constructor (iterable?: Array<number>): void;
findMax (node?: ?BinaryTreeNode): ?BinaryTreeNode;
findMin (node?: ?BinaryTreeNode): ?BinaryTreeNode;
getHeight (node?: ?BinaryTreeNode): number;
inOrder (node?: ?BinaryTreeNode): Array<BinaryTreeNode>;
insert (value: any): void;
levelOrder (node?: ?BinaryTreeNode): Array<BinaryTreeNode>;
postOrder (node?: ?BinaryTreeNode): Array<BinaryTreeNode>;
preOrder (node?: ?BinaryTreeNode): Array<BinaryTreeNode>;
remove (value: any): void;
search (value: any): ?BinaryTreeNode;
toArray (traversal: $Keys<{ IN_ORDER: string, LEVEL_ORDER: string, POST_ORDER: string, PRE_ORDER: string }>, flatten?: boolean): Array<BinaryTreeNode | any>;
}

declare export var TraversalType: { IN_ORDER: string, LEVEL_ORDER: string, POST_ORDER: string, PRE_ORDER: string };

declare export class BinaryTreeNode {

_left: ?BinaryTreeNode;
_right: ?BinaryTreeNode;
_value: any;
get left (): ?BinaryTreeNode
set left (value: ?BinaryTreeNode): void;
get right (): ?BinaryTreeNode
set right (value: ?BinaryTreeNode): void;
get value (): any
set value (value: any): void;
constructor (value: any): void;
}

declare export class LinkedList {

_head: ?ListNode;
_size: number;
_tail: ?ListNode;
get head (): ?ListNode;
get size (): number;
get tail (): ?ListNode;
append (value: any): number;
constructor (iterable?: Array<any>): void;
insert (position: number, value: any): number;
pop (): any;
prepend (value: any): number;
push (value: any): number;
remove (position: number): any;
shift (): any;
toArray (): Array<any>;
unshift (value: any): number;
}

declare export class ListNode {

_next: ?ListNode;
_prev: ?ListNode;
_value: any;
get next (): ?ListNode
set next (value: ?ListNode): void;
get prev (): ?ListNode
set prev (value: ?ListNode): void;
get value (): any
set value (value: any): void;
constructor (item: any): void;
}

declare export class Map extends Map<any, any> {

constructor (iterable: Array<any>): any;
every (callback: (value: any, key: any, map: Map<any, any>) => boolean): boolean;
setDefault (key: any, defaultValue: any): any;
some (callback: (value: any, key: any, map: Map<any, any>) => boolean): boolean;
toObject (): any;
}

declare export var Math: { factorial: (num: number) => number };
declare export var _Math: { factorial: (num: number) => number };

declare export function mergeSort (arr: Array<any>, comparator?: any): Array<any | any>;

declare export class Number extends Number {
static fromRomanNumeral (str: string): number;

constructor (number: number): void;
toRomanNumeral (): string;
}

declare export class Object extends Object {

clone (config?: { includeNonEnumerable: ?boolean }): Object;
constructor (object: Object): void;
getNested (path: string): any;
hasNested (path: string): boolean;
}

declare export class PriorityQueue {
static _defaultComparator (a: any, b: any): number | boolean;
static _wrapComparator (comparator: any): any;

_comparator: any;
_queue: Array<any>;
get high (): any;
get low (): any;
get max (): any;
get min (): any;
get size (): number;
clear (): void;
constructor (iterable?: Map<number, any> | [any] | [[number, any]] | [{ priority: number, value: any }], comparator: any): void;
deleteHigh (): any;
deleteLow (): any;
deleteMax (): any;
deleteMin (): any;
insert (value: any, priority?: number): number;
isEmpty (): boolean;
toArray (): Array<any>;
}

declare export class QueueNode {

_priority: number;
_value: any;
get priority (): number;
get value (): any;
constructor (value: any, priority: number): void;
}

declare export class Queue {

_queue: Array<any>;
get front (): any;
get rear (): any;
get size (): number;
clear (): void;
constructor (iterable?: Array<any>): void;
dequeue (): any;
enqueue (item: any): number;
isEmpty (): boolean;
toArray (): Array<any>;
}

declare export class Set extends Set<any> {

constructor (iterable: Array<any>): void;
difference (setB: Set<any>): Set<any>;
every (callback: (value1: any, value2: any, set: Set<any>) => boolean): boolean;
intersection (setB: Set<any>): Set<any>;
isSubset (setB: Set<any>): boolean;
isSuperset (setB: Set<any>): boolean;
some (callback: (value1: any, value2: any, set: Set<any>) => boolean): boolean;
symmetricDifference (setB: Set<any>): Set<any>;
union (setB: Set<any>): Set<any>;
}

declare export class String extends String {

constructor (string: string): void;
reverse (): string;
reverseWords (): string;
toTitleCase (): string;
}

declare export class Trie {

_root: TrieNode;
get root (): TrieNode;
constructor (iterable?: Array<string>): void;
contains (word: string): boolean;
includes (word: string): boolean;
insert (word: string): void;
remove (word: string): boolean;
search (query: string): { isCompleteWord: boolean, isMatch: boolean, matchedChars: number, node: ?TrieNode, query: string };
startsWith (prefix: string): boolean;
}

declare export class TrieNode {

_char: any;
_children: Map<any, TrieNode>;
_isCompleteWord: boolean;
get char (): any;
get count (): number;
get isCompleteWord (): boolean;
get isLeafNode (): boolean;
constructor (char?: any): void;
delete (char: any): void;
get (char: any): ?TrieNode;
has (char: any): boolean;
set (char: any, node: TrieNode): void;
}
2 changes: 1 addition & 1 deletion dist/super.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit be6e55a

Please sign in to comment.