bump version to v0.0.18

This commit is contained in:
woodser 2023-11-02 06:21:46 -04:00
parent 30864eea0c
commit 3b79477d84
5 changed files with 30 additions and 8 deletions

View File

@ -99,6 +99,14 @@ export default class HavenoUtils {
* @return {string} the stringified form * @return {string} the stringified form
*/ */
static formToString(form: PaymentAccountForm): string; static formToString(form: PaymentAccountForm): string;
/**
* Determine if a form has a field.
*
* @param {PaymentAccountForm} form - form to check
* @param {PaymentAccountFormField.FieldId} fieldId - id of the field to check for
* @return {boolean} true if the form has the field, false otherwise
*/
static hasFormField(form: PaymentAccountForm, fieldId: PaymentAccountFormField.FieldId): boolean;
/** /**
* Get a form field value. * Get a form field value.
* *
@ -110,10 +118,10 @@ export default class HavenoUtils {
/** /**
* Set a form field value. * Set a form field value.
* *
* @param {PaymentAccountForm} form - form to get the field from
* @param {PaymentAccountFormField.FieldId} fieldId - id of the field to set the value of * @param {PaymentAccountFormField.FieldId} fieldId - id of the field to set the value of
* @param {string} value - field value to set * @param {string} value - field value to set
* @param {PaymentAccountForm} form - form to get the field from
* @return {string} the form field value * @return {string} the form field value
*/ */
static setFormValue(fieldId: PaymentAccountFormField.FieldId, value: string, form: PaymentAccountForm): void; static setFormValue(form: PaymentAccountForm, fieldId: PaymentAccountFormField.FieldId, value: string): void;
} }

View File

@ -168,6 +168,20 @@ class HavenoUtils {
} }
return str.trim(); return str.trim();
} }
/**
* Determine if a form has a field.
*
* @param {PaymentAccountForm} form - form to check
* @param {PaymentAccountFormField.FieldId} fieldId - id of the field to check for
* @return {boolean} true if the form has the field, false otherwise
*/
static hasFormField(form, fieldId) {
for (const field of form.getFieldsList()) {
if (field.getId() === fieldId)
return true;
}
return false;
}
/** /**
* Get a form field value. * Get a form field value.
* *
@ -186,12 +200,12 @@ class HavenoUtils {
/** /**
* Set a form field value. * Set a form field value.
* *
* @param {PaymentAccountForm} form - form to get the field from
* @param {PaymentAccountFormField.FieldId} fieldId - id of the field to set the value of * @param {PaymentAccountFormField.FieldId} fieldId - id of the field to set the value of
* @param {string} value - field value to set * @param {string} value - field value to set
* @param {PaymentAccountForm} form - form to get the field from
* @return {string} the form field value * @return {string} the form field value
*/ */
static setFormValue(fieldId, value, form) { static setFormValue(form, fieldId, value) {
for (const field of form.getFieldsList()) { for (const field of form.getFieldsList()) {
if (field.getId() === fieldId) { if (field.getId() === fieldId) {
field.setValue(value); field.setValue(value);

File diff suppressed because one or more lines are too long

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "haveno-ts", "name": "haveno-ts",
"version": "0.0.17", "version": "0.0.18",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "haveno-ts", "name": "haveno-ts",
"version": "0.0.17", "version": "0.0.18",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@types/node": "^18.14.2", "@types/node": "^18.14.2",

View File

@ -1,6 +1,6 @@
{ {
"name": "haveno-ts", "name": "haveno-ts",
"version": "0.0.17", "version": "0.0.18",
"description": "Haveno TypeScript interface", "description": "Haveno TypeScript interface",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",