typescript-generics
v1.0.2
Published
Generics in Typescript
Downloads
2
Maintainers
Readme
What is tgeneric ?
It provides C# like generic data structure in Typescript
- List
- Dictionary
Library Documentation :
List
clear
Returns empty list
function clearDemo(){
let numList = new List<number>();
numList.add(3);
numList.add(100);
numList.add(2);
numList.add(10);
numList.add(4);
console.log(numList.clear()); // will Print {}
};
contains
checks if elements exist in list
function containDemo(){
let numList = new List<number>();
numList.add(3);
numList.add(100);
numList.add(2);
numList.add(10);
numList.add(4);
console.log(numList.contains(3)); // will Print true
};
exist
Returns true if element satisfies predicate
function existDemo(){
let numList = new List<number>();
numList.add(3);
numList.add(100);
numList.add(2);
numList.add(10);
numList.add(4);
console.log(numList.exist(3)); // will Print true
};