8 Commits

Author SHA1 Message Date
36d26f6ff8 1.0.12 2021-08-19 18:42:52 +02:00
cbbf90f6f1 fix(core): update 2021-08-19 18:42:52 +02:00
935ea4386c 1.0.11 2021-08-19 18:40:04 +02:00
df430fa033 fix(core): update 2021-08-19 18:40:04 +02:00
acbe290526 1.0.10 2021-08-16 16:31:05 +02:00
98f99bd18d fix(core): update 2021-08-16 16:31:04 +02:00
3de22d3e20 1.0.9 2021-08-16 15:37:02 +02:00
df997c41e3 fix(core): update 2021-08-16 15:37:02 +02:00
4 changed files with 62 additions and 5 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@pushrocks/smartstatus", "name": "@pushrocks/smartstatus",
"version": "1.0.8", "version": "1.0.12",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@pushrocks/smartstatus", "name": "@pushrocks/smartstatus",
"version": "1.0.8", "version": "1.0.12",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.25", "@gitzone/tsbuild": "^2.1.25",

View File

@ -1,13 +1,13 @@
{ {
"name": "@pushrocks/smartstatus", "name": "@pushrocks/smartstatus",
"version": "1.0.8", "version": "1.0.12",
"private": false, "private": false,
"description": "status information in TypeScript", "description": "status information in TypeScript",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/)",
"build": "tsbuild" "build": "tsbuild --web"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

47
readme.md Normal file
View File

@ -0,0 +1,47 @@
# @pushrocks/smartstatus
status information in TypeScript
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartstatus)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartstatus)
* [github.com (source mirror)](https://github.com/pushrocks/smartstatus)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartstatus/)
## Status for master
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartstatus/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartstatus/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartstatus)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartstatus)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartstatus)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartstatus)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartstatus)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage
Use TypeScript for best in class instellisense.
For further information read the linked docs at the top of this README.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -6,7 +6,17 @@ export class HttpStatus {
HttpStatus.statusMap[statusStringArg] = statusArg; HttpStatus.statusMap[statusStringArg] = statusArg;
} }
public static getHttpStatusByString(codeStringArg: string): HttpStatus { public static getHttpStatusByString(codeStringArg: string): HttpStatus {
const statusInstance = new HttpStatus.statusMap[codeStringArg](); let statusInstance: HttpStatus;
try {
statusInstance = new HttpStatus.statusMap[codeStringArg]();
} catch {
console.log('unknown status')
return new HttpStatus({
code: 0,
text: 'unknown status',
description: `The status ${codeStringArg} is not known.`
});
}
return statusInstance; return statusInstance;
} }
public code: number; public code: number;