This file contains hidden or 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
| /** | |
| * Represents the search keywords for a search engine. | |
| */ | |
| type TSearchKeywords = { | |
| exact: Array<string>; | |
| partial: Array<string>; | |
| exclude: Array<string>; | |
| }; | |
| /** |
This file contains hidden or 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
| /** | |
| * Represents a request object. | |
| */ | |
| export type TRequest = { | |
| id: number; | |
| title: string; | |
| url: string; | |
| timeout: number; | |
| }; |
This file contains hidden or 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 type { Updater, Writable } from 'svelte/store'; | |
| export type ChangeFn<T> = (args: { curr: T; next: T }) => T; | |
| export const overridable = <T>(store: Writable<T>, onChange?: ChangeFn<T>) => { | |
| const update = (updater: Updater<T>, sideEffect?: (newValue: T) => void) => | |
| store.update((curr) => { | |
| const next = updater(curr); | |
| let res: T = next; | |
| if (onChange) res = onChange({ curr, next }); |
This file contains hidden or 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 { AnyZodObject, ZodError, z } from 'zod'; | |
| import { fromZodError } from 'zod-validation-error'; | |
| export async function zParse<T extends AnyZodObject>( | |
| schema: T, | |
| data: any | |
| ): Promise<z.infer<T>> { | |
| try { | |
| return await schema.parseAsync(data); | |
| } catch (error) { |
This file contains hidden or 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 users = [ | |
| { id: 1, name: 'Bruno', group: 'admin' }, | |
| { id: 2, name: 'João', group: 'coder' }, | |
| { id: 3, name: 'Maria', group: 'coder' }, | |
| ]; | |
| // --- Solution 01 --- | |
| function groupBy(array, callback) { | |
| return array.reduce((accumulator, item) => { | |
| const key = callback(item); |
This file contains hidden or 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
| <h1 align="center"> | |
| <br> | |
| <img src="YOUR_LOGO_URL" alt="YOUR_PROJECT_NAME" width="120"> | |
| <br> | |
| <br> | |
| YOUR_PROJECT_NAME | |
| </h1> | |
| <p align="center">A little description about your project</p> |
This file contains hidden or 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
| // moment.js locale configuration | |
| // locale : brazilian portuguese (pt-br) | |
| // author : Caio Ribeiro Pereira : https://github.com/caio-ribeiro-pereira | |
| (function (factory) { | |
| if (typeof define === 'function' && define.amd) { | |
| define(['moment'], factory); // AMD | |
| } else if (typeof exports === 'object') { | |
| module.exports = factory(require('../moment')); // Node | |
| } else { |