Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

namirasoft-core

Package Overview
Dependencies
Maintainers
1
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

namirasoft-core - npm Package Compare versions

Comparing version 1.0.13 to 1.0.14

4

dist/ConvertService.d.ts
export declare abstract class ConvertService {
private mandatory;
constructor(mandatory?: boolean);
abstract getNullString(): string | null;
private checkMandatory;
protected onMandatoryError(): void;
getString(_default?: string): string;

@@ -4,0 +8,0 @@ getNullInt(): number | null;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConvertService = void 0;
const ErrorOperation_1 = require("./ErrorOperation");
class ConvertService {
constructor(mandatory = false) {
this.mandatory = mandatory;
}
checkMandatory(value) {
if (this.mandatory)
if (value == null || value == undefined || !value)
this.onMandatoryError();
return value;
}
onMandatoryError() {
ErrorOperation_1.ErrorOperation.throwHTTP(500, "Object value can not be converted.");
}
getString(_default = "") {
var _a;
return (_a = this.getNullString()) !== null && _a !== void 0 ? _a : _default;
return (_a = this.checkMandatory(this.getNullString())) !== null && _a !== void 0 ? _a : _default;
}

@@ -20,3 +33,3 @@ getNullInt() {

var _a;
return (_a = this.getNullInt()) !== null && _a !== void 0 ? _a : _default;
return (_a = this.checkMandatory(this.getNullInt())) !== null && _a !== void 0 ? _a : _default;
}

@@ -34,3 +47,3 @@ getNullFloat() {

var _a;
return (_a = this.getNullFloat()) !== null && _a !== void 0 ? _a : _default;
return (_a = this.checkMandatory(this.getNullFloat())) !== null && _a !== void 0 ? _a : _default;
}

@@ -50,3 +63,3 @@ getNullBoolean() {

var _a;
return (_a = this.getNullBoolean()) !== null && _a !== void 0 ? _a : _default;
return (_a = this.checkMandatory(this.getNullBoolean())) !== null && _a !== void 0 ? _a : _default;
}

@@ -53,0 +66,0 @@ getStringArray(delimiter = ",") {

2

package.json
{
"name": "namirasoft-core",
"description": "Namira Software Corporation Core NPM Package",
"version": "1.0.13",
"version": "1.0.14",
"main": "./dist/index.js",

@@ -6,0 +6,0 @@ "types": "./dist/index.d.ts",

@@ -0,7 +1,25 @@

import { ErrorOperation } from "./ErrorOperation";
export abstract class ConvertService
{
private mandatory: boolean;
constructor(mandatory: boolean = false)
{
this.mandatory = mandatory;
}
abstract getNullString(): string | null;
private checkMandatory<D>(value: D): D
{
if (this.mandatory)
if (value == null || value == undefined || !value)
this.onMandatoryError();
return value;
}
protected onMandatoryError(): void
{
ErrorOperation.throwHTTP(500, "Object value can not be converted.");
}
getString(_default: string = ""): string
{
return this.getNullString() ?? _default;
return this.checkMandatory(this.getNullString()) ?? _default;
}

@@ -20,3 +38,3 @@ getNullInt(): number | null

{
return this.getNullInt() ?? _default;
return this.checkMandatory(this.getNullInt()) ?? _default;
}

@@ -35,3 +53,3 @@ getNullFloat(): number | null

{
return this.getNullFloat() ?? _default;
return this.checkMandatory(this.getNullFloat()) ?? _default;
}

@@ -52,3 +70,3 @@ getNullBoolean(): boolean | null

{
return this.getNullBoolean() ?? _default;
return this.checkMandatory(this.getNullBoolean()) ?? _default;
}

@@ -55,0 +73,0 @@ getStringArray(delimiter: string = ","): string[]

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc