felixriddle.my-types
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -18,2 +18,34 @@ /** | ||
/** | ||
* For easier handling of the status object | ||
*/ | ||
declare class StatusWrapper { | ||
status: Status; | ||
constructor(status: Status); | ||
/** | ||
* Get the object | ||
*/ | ||
get(): Status; | ||
/** | ||
* Check if the object is just using default values | ||
* | ||
* @returns {bool} | ||
*/ | ||
isDefault(): boolean; | ||
/** | ||
* Set this object as an error and give it a message | ||
* | ||
* @param {string} field The field name for example 'email', 'password' | ||
* @param {string} message The field message for example 'Email not given' | ||
*/ | ||
static newError(field: FieldType, message: string): Status; | ||
/** | ||
* Set this object as a success | ||
* | ||
* @param {string} field The field name for example 'email', 'password' | ||
* @param {string} message The field message for example 'Email Ok' | ||
*/ | ||
static newSuccess(field: FieldType, message: string): Status; | ||
} | ||
interface DeleteUserResultType { | ||
@@ -183,2 +215,2 @@ userDeleted: boolean; | ||
export type { BackdoorConfirmEmailInputType, BackdoorConfirmEmailResultType, CategoryType, CompleteUserData, CreateUserPropertyInputType, CreateUserPropertyResultType, DataResultType, DebugMessage, DebugPropertyImageUploadType, DeleteUserPropertyResultType, DeleteUserResultType, FieldStatusType, LoginGetJwtResultType, MyPropertiesPageResultType, PriceType, PropertyCompleteType, PropertyType, Status }; | ||
export { type BackdoorConfirmEmailInputType, type BackdoorConfirmEmailResultType, type CategoryType, type CompleteUserData, type CreateUserPropertyInputType, type CreateUserPropertyResultType, type DataResultType, type DebugMessage, type DebugPropertyImageUploadType, type DeleteUserPropertyResultType, type DeleteUserResultType, type FieldStatusType, type LoginGetJwtResultType, type MyPropertiesPageResultType, type PriceType, type PropertyCompleteType, type PropertyType, type Status, StatusWrapper }; |
@@ -6,2 +6,6 @@ "use strict"; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
@@ -19,3 +23,62 @@ if (from && typeof from === "object" || typeof from === "function") { | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
StatusWrapper: () => StatusWrapper | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
// src/lib/StatusWrapper.ts | ||
var StatusWrapper = class { | ||
constructor(status) { | ||
this.status = status; | ||
} | ||
/** | ||
* Get the object | ||
*/ | ||
get() { | ||
return this.status; | ||
} | ||
/** | ||
* Check if the object is just using default values | ||
* | ||
* @returns {bool} | ||
*/ | ||
isDefault() { | ||
if (!this.status.error && this.status.message.length === 0) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
/** | ||
* Set this object as an error and give it a message | ||
* | ||
* @param {string} field The field name for example 'email', 'password' | ||
* @param {string} message The field message for example 'Email not given' | ||
*/ | ||
static newError(field, message) { | ||
const status = { | ||
error: true, | ||
field, | ||
message | ||
}; | ||
return status; | ||
} | ||
/** | ||
* Set this object as a success | ||
* | ||
* @param {string} field The field name for example 'email', 'password' | ||
* @param {string} message The field message for example 'Email Ok' | ||
*/ | ||
static newSuccess(field, message) { | ||
const status = { | ||
error: false, | ||
field, | ||
message | ||
}; | ||
return status; | ||
} | ||
}; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
StatusWrapper | ||
}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "felixriddle.my-types", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20682
328