This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function median3(a: number, b: number, c: number): number { | |
if ((a - b) * (c - a) >= 0) { | |
return a; | |
} else if ((b - a) * (c - b) >= 0) { | |
return b; | |
} | |
return c; | |
} | |
console.log(2 === median3(1, 2, 3)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const words = ["eat", "tea", "tan", "ate", "nat", "bat"]; | |
function updateDictionary(dict: object, word: string): void { | |
const key = word.split('').sort().join(''); | |
if (!dict.hasOwnProperty(key)) { | |
dict[key] = []; | |
} | |
dict[key].push(word); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const str = ' some string '; | |
function normalize(input: string): string { | |
let length = input.length; | |
let i = 0; | |
while (i < length - 1) { | |
const char: string = input[i]; | |
const nextChar: string = input[i + 1]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mockupFetch(cache: object, url: stirng) { | |
return new Promise((resolve) => { | |
if (cache.hasOwnProperty(url)) { | |
return resolve(cache[url]); | |
} | |
setTimeout(() => { | |
const date = new Date(); | |
const min = date.getMinutes(); | |
const sec = date.getSeconds(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = { | |
value: 123, | |
next: { | |
value: 321, | |
next: { | |
value: 348, | |
next: { | |
value: 981, | |
next: { | |
value: 712, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare namespace BemSDK { | |
export namespace EntityName { | |
/** | |
* Object to representation of entity name. | |
*/ | |
interface EntityRepresentation { | |
/** | |
* The block name of entity. | |
*/ | |
block: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as path from 'path'; | |
import * as fs from 'fs'; | |
import * as micromatch from 'micromatch'; | |
import * as io from '../utils/io'; | |
import { ITask, IOptions, IEntry } from '../types'; | |
export type TMatch = string | IEntry; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> fast-glob@3.2.0 bench /home/mrmlnc/fast-glob | |
> npm run bench-async && npm run bench-stream && npm run bench-sync | |
> fast-glob@3.2.0 bench-async /home/mrmlnc/fast-glob | |
> npm run bench-async-flatten && npm run bench-async-deep && npm run bench-async-partial-flatten && npm run bench-async-partial-deep | |
> fast-glob@3.2.0 bench-async-flatten /home/mrmlnc/fast-glob | |
> node ./out/benchmark --mode async --pattern "*" |
OlderNewer