1.0.10 • Published 4 years ago

@tszone/ext v1.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

ext.ts

language extensions for typescript

IterableIterator

  1. skip
const v = ['a', 'b', 'c'];
const v1 = v.values().skip(2).toArray();
console.log(v1.length); // 1
console.log(v1[0]); // 'c'
  1. skipWhile
const v = ['a', 'b', 'c'];
const v1 = v.values().skipWhile((s) => s === 'b').toArray();
console.log(v1.length); // 1
console.log(v1[0]); // 'c'

Array

  1. sequenceEqual
import '@tszone/ext';

const a = [1, 2, 4];
const b = [1, 2, 5];
console.log(a.sequenceEqual(b)) // false

Promise

  1. yield
import '@tszone/ext';

async function abc(): Promise<void> {
     // some work.
     await Promise.yield();
     // do your work.
     await Promise.yield(20); // wait for 20ms.
     // do your other work.
}

Math

  1. randint
const a = Math.randint(3);
console.log(a); // [0, 3);
const b = Math.randint(3, 6);
console.log(b); // [3, 6);
1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago