3.2.1 • Published 1 year ago

tripetto-block-calculator v3.2.1

Weekly downloads
140
License
MIT
Repository
gitlab
Last release
1 year ago

Tripetto is a full-fledged form kit. Rapidly build and run smart flowing forms and surveys. Drop the kit in your codebase and use all of it or just the parts you need. The visual builder is for form building, and the runners are for running those forms in different UI variants. It is entirely extendible and customizable. Anyone can build their own building blocks (e.g., question types) or runner UI's.

Calculator block

Status Version License Downloads Follow us on Twitter

Calculator block for Tripetto. This block can perform all sorts of calculations (see a list of supported operations below). It is a headless block, so it doesn't require a UI implementation for the runner.

Supported operations

OperationDescription
INPUTS
Static numberSupplies a static number to the calculator.
Recall valueSupplies the value of another question block (for example from a number block, rating block or scale block) to the calculator.
SubcalculationPerforms a (sub) calculation for multistep formulas and supplies the result to the calculator.
FUNCTIONS
Limiting
minReturns the input with the lowest number.
maxReturns the input with the highest number.
clampClamps (restricts) the input between the specified minimum and maximum value (learn more).
Floating point
roundRounds a floating point number (learn more).
floorRounds a floating point number down (learn more).
ceilRounds a floating point number up (learn more).
truncRemoves decimals from a floating point number.
Exponentiation
Multiplies the given input by itself (learn more).
Finds the principal square root for the given input (learn more).
powCalculates the base to the power of the given exponent (learn more).
expCalculates e to the power of the given exponent (learn more).
lnCalculates the natural logarithm of the input (learn more).
logCalculates the base 10 logarithm of the input (learn more).
Trigonometry
sinCalculates the sine of the given angle (learn more).
cosCalculates the cosine of the given angle (learn more).
tanCalculates the tangent of the given angle (learn more).
sin⁻¹Calculates the inverse sine (arcsine) of the given number (learn more).
cos⁻¹Calculates the inverse cosine (arccosine) of the given number (learn more).
tan⁻¹Calculates the inverse tangent (arctangent) of the given number (learn more).
sinhCalculates the hyperbolic sine of the given hyperbolic angle (learn more).
coshCalculates the hyperbolic cosine of the given hyperbolic angle (learn more).
tanhCalculates the hyperbolic tangent of the given hyperbolic angle (learn more).
sinh⁻¹Calculates the inverse hyperbolic sine (arcsine) of the given number (learn more).
cosh⁻¹Calculates the inverse hyperbolic cosine (arccosine) of the given number (learn more).
tanh⁻¹Calculates the inverse hyperbolic tangent (arctangent) of the given number (learn more).
Factorial
n!Calculates the factorial of a positive number (learn more).
gammaCalculates the gamma of a positive number (learn more).
Miscellaneous
absRetrieves the absolute value (or modulus) of a number (learn more).
ageCalculates the age based on the input of a date block, for example a date of birth.
yearCalculates the year of a given date.
monthCalculates the month of a given date.
day of monthCalculates the day of the month of a given date.
day of weekCalculates the day of the week of a given date.
hourCalculates the hour of a given time.
minuteCalculates the minute of a given time.
secondCalculates the second of a given time.
millisecondCalculates the millisecond of a given time.
countCounts the number of selected options, for example from a checkboxes block, or a picture choice block (multiple selection).
modCalculates the remainder of a division (learn more).
scoreScores options of a block (for example a dropdown block, radio buttons block or a picture choice block).
sgnExtracts the sign of a number (learn more).
%Calculates a percentage of the input (learn more).
COMPARATORS
Compare valueCompares the recalled value of another block and outputs a value based on the result of the comparison.
Compare current outcomeCompares the current outcome of the calculator and outputs a value based on the result of the comparison.
Compare numberCompares a static number and outputs a value based on the result of the comparison.
Compare date/timeCompares a date (and time) and outputs a value based on the result of the comparison.
Check selected optionChecks if a certain option is checked (for example from a multiple choice block) and outputs a value based on the result of the comparison.
TEXT FUNCTIONS
Character countCounts the number of characters in a text.
Word countCounts the number of words in a text.
Line countCounts the number of lines in a text.
Count occurrencesCounts the number of occurrences of a certain text or character.
Convert to numberConverts a text value to a number.
CONSTANTS
πSupplies the constant value of π (pi ≈ 3.14159) to the calculator (learn more).
eSupplies the constant value of e (Euler's constant ≈ 2.71828) to the calculator (learn more).
γSupplies the constant value of γ (Euler–Mascheroni constant ≈ 0.57722) to the calculator (learn more).
cSupplies the constant value of c (speed of light = 299792458 m/s) to the calculator (learn more).
Random valueSupplies a random value (0 to less than 1) to the calculator.
UNIX timeSupplies the current UNIX time (seconds since Unix Epoch) to the calculator.
YearSupplies the current year to the calculator.
MonthSupplies the current month (January = 1) to the calculator.
Day of monthSupplies the current day of month (1-31) to the calculator.
Day of weekSupplies the current day of week (Sunday = 0) to the calculator.
HourSupplies the current hour (0-23) to the calculator.
MinuteSupplies the current minute (0-59) to the calculator.
SecondSupplies the current second (0-59) to the calculator.
MillisecondSupplies the current millisecond (0-999) to the calculator.
TimezoneSupplies the current timezone (in milliseconds) to the calculator.

Get started

You need to install or import this block to use it in Tripetto. If you are using the CLI version of the builder, you can find instructions here. If you are embedding the builder into your own project using the library, take a look here.

Use cases

  • Directly in your browser (add <script src="https://unpkg.com/tripetto-block-calculator"></script> to your HTML);
  • In the CLI builder (install the block using npm i tripetto-block-calculator -g and update your Tripetto config);
  • In your builder implementation (just add import "tripetto-block-calculator"; to your code);
  • In your runner implementation (simply add import "tripetto-block-calculator/runner"; to your code.

Support

Run into issues or bugs? Report them here and we'll look into them.

For general support contact us at support@tripetto.com. We're more than happy to assist you.

License

Have a blast. MIT.

Contributors

About us

If you want to learn more about Tripetto or contribute in any way, visit us at Tripetto.com.

3.2.1

1 year ago

3.2.0

2 years ago

3.1.2

2 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.1.0

3 years ago

2.0.1-0

3 years ago

1.3.1-10

3 years ago

1.3.1-12

3 years ago

1.3.1-11

3 years ago

1.3.1-13

3 years ago

2.0.0

3 years ago

1.3.1-7

3 years ago

1.3.1-9

3 years ago

1.3.1-8

3 years ago

1.3.1-6

3 years ago

1.3.1-5

3 years ago

1.3.1-4

3 years ago

1.3.1-3

3 years ago

1.3.1-2

3 years ago

1.3.1-1

3 years ago

1.3.1-0

3 years ago

1.3.0

3 years ago

1.2.2-8

3 years ago

1.2.2-7

3 years ago

1.2.2-6

3 years ago

1.2.2-5

3 years ago

1.2.2-3

3 years ago

1.2.2-4

3 years ago

1.2.2-2

3 years ago

1.2.2-1

3 years ago

1.2.2-0

3 years ago

1.2.0

3 years ago

1.2.1

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago