Skip to content

Instantly share code, notes, and snippets.

@har0ld-scl
har0ld-scl / storybook.safeText.ts
Last active October 1, 2020 17:51
A storybook text knob wrapper
const safeText = (name: string, value: string, possibleValues: string[], groupId?: string): any => {
const result = text(name, value, groupId);
if (possibleValues.includes(result)) {
return result;
} else if (result.trim() === '') {
return undefined;
} else {
return value;
}
export const ResetConsole = '\x1b[0m';
export const Bright = '\x1b[1m';
export const Dim = '\x1b[2m';
export const Underscore = '\x1b[4m';
export const Blink = '\x1b[5m';
export const Reverse = '\x1b[7m';
export const Hidden = '\x1b[8m';
export const FgBlack = '\x1b[30m';
export const FgRed = '\x1b[31m';
export const FgGreen = '\x1b[32m';
@har0ld-scl
har0ld-scl / httpStatusCode.ts
Created April 23, 2020 00:26
Typescript enum with Http Status codes
/**
* Contains the values of status codes defined for Hypertext Transfer Protocol (HTTP).
* @export
* @enum {number}
*/
export enum HttpStatusCode {
/**
* Equivalent to HTTP status 100. Continue indicates that
* the client can continue with its request.
*/