Skip to content

Instantly share code, notes, and snippets.

View itssimmons's full-sized avatar
🤙
"use strict";

Simón Villafañe itssimmons

🤙
"use strict";
View GitHub Profile
@itssimmons
itssimmons / index.ts
Last active April 15, 2022 04:42
Debug deno on vscode
/**
* @description create a to recreate the fibonacci sequence and returns it into an array
* @param n total of loops
* @returns and array filled with fibonacci sequence
* @example [0,1,1,2,3,5,8,13,21...]
*/
export function fibonashi(n: number): unknown[] {
const a: number[] = [0, 1];
if (n === 1) return [0];
if (n === 2) return [0, 1];
@itssimmons
itssimmons / bored-switch.ts
Last active January 19, 2022 23:14
Don't use switch use an object! 😉
import { joke, hardJoke, riddle } from '@/content'
import getQuote, { getAllQuotes } from '@/helpers/quotes'
import { Fact } from '@/types/common.types'
export function boredSwitch(topic: string): Fact {
switch (topic.toLowerCase()) {
case 'quote':
return getQuote()
break
case 'all-quotes':
@itssimmons
itssimmons / jest.config.js
Last active January 20, 2022 00:02
Simple configuration to set up jest and typescript with its custom paths 📁🧪
const { pathsToModuleNameMapper } = require('ts-jest');
//const { pathsToModuleNameMapper } = require('ts-jest/utils'); // also you can do like this, but jest recommends use one above
const { compilerOptions } = require('./tsconfig.json');
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
coverageDirectory: './coverage',
testMatch: [ "**/?(*.)+(test).ts" ],