1.4.4 • Published 2 years ago
majotools v1.4.4
majotools
table of contents
about
This library provides constants, types, function, interfaces and classes for nodejs.
Rules for library content:
- Content should not depend on other packages.
getting started
npm i majotools
examples
node
import { node } from "majotools"
node.node()
string functions
export function isAlphaNumericCharCode(charCode: number): boolean
export function isUppercaseAlphabeticCharCode(charCode: number): boolean
export function isLowercaseAlphabeticCharCode(charCode: number): boolean
export function isNumericCharCode(charCode: number): boolean
json types and function
export type JsonBase = boolean | number | string | null // Json primitive types
export type JsonHolder = JsonArray | JsonObject // A json object or array
export type JsonArray = Array<JsonTypes> // A array with just json type values
export type JsonObject = ObjectType<JsonTypes> // A object with just json type values
export type JsonTypes = JsonBase | JsonHolder // Can be every json type
export interface ObjectType<V> { // Object that holds the generec type as values
[key: string]: V
}
export function polishValues<T extends JsonHolder>(
holder: T,
recursive: boolean = true
): T
ip functions
export function isIp(string: string): boolean
export function isIpv4(string: string): boolean
export function isIpv6(string: string): boolean
http status and methods
export function isHttpMethod(method: string): boolean
export function getStatusByReason(reason: string): HttpStatus | null
export function getStatusByCode(code: number): HttpStatus
// and some more...
npm scripts
The npm scripts are made for linux but can also work on mac and windows.
use
You can run npm scripts in the project folder like this:
npm run <scriptname>
Here is an example:
npm run test
base scripts
You can find all npm scripts in the package.json
file.
This is a list of the most important npm scripts:
- test // test the app
- build // build the app
- exec // run the app
- start // build and run the app
watch mode
Like this example you can run all npm scripts in watch mode:
npm run start:watch
contribution
- fork the project
- implement your idea
- create a pull/merge request
// please create seperated forks for different kind of featues/ideas/structure changes/implementations
cya ;3
by majo418