Skip to content

Instantly share code, notes, and snippets.

View dakshinasd's full-sized avatar
☠️
404

Dakshina Wijesuriya dakshinasd

☠️
404
View GitHub Profile
@dakshinasd
dakshinasd / ts-function-overload.ts
Created February 11, 2022 19:23
TypeScript Function Overload
// as per https://www.youtube.com/watch?v=XnyZXNnWAOA
interface Coordinate {
x: number;
y: number;
}
function parseCordinates(obj: Coordinate): Coordinate;
function parseCordinates(str: string): Coordinate;
function parseCordinates(num1: number, num2: number): Coordinate;
@dakshinasd
dakshinasd / flatner.js
Last active May 6, 2021 03:51
Object Flatner
/*
Write a function to flatten the following nested object to an array of objects.
Your function should be able to handle any level of nesting and it should have better performance.
Expected output ex:
[
{title: 'Foo', value: 111},
{title: 'Bar', value: 222},
...