npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

et-exp-sdk

v1.0.5

Published

Evaluate the User Expression

Downloads

3

Readme

et-nd-exp-sdk

NPM version NPM downloads

This SDK comes bundled with a range of methods that are useful in parsing and evaluating the expressions of the following kind:

  • numeric operations
  • date validation
  • time expressions
  • financial expressions
  • loop and logical expression
  • sentence expression

Table of Contents

  1. Getting Started
  2. Installation
  3. Initialization
  4. APIs
    1. Class: EvalSdkCore
    2. Methods
    3. init(host: string, port?: number, basePath?: string): EvalSdkCore
    4. Example
    5. evaluateExpression(expression: string): Promise
    6. Example
  5. Release Notes & Breaking Changes
  6. License
  7. Contributing

Getting Started

Installation

 $ npm install et-nd-exp-sdk

Initialization

Initialize the module before accessing its methods. (Note: host and port values must be valid.)

  // @ts-ignore
  const sdk = require("et-nd-epr-sdk");
  const opts = { 
    host: "localhost", 
    port: 9999, 
    basePath: ""
  }

  const etExprSDK = sdk.init(opts);

APIs

Class: EvalSdkCore

Methods

init(host: string, port: number, basePath: string): Promise<EvalSdkCore>

init() method initializes and returns an instance of the class EvalSdkCore

| Name | Type | Required | Default | Description | |:-----------|:----------|:---------|:--------|:-----------------------------------------------------| | opts.host | string | true | -- | The host url of the end point, ex: http://api-gateway/| | opts.port | number | false | 80 | usually 80, must be empty if need to use host URL as it is| | opts.basePath | string | false | "" | could be empty as well |

Example

  // @ts-ignore
  const sdk = require("et-nd-epr-sdk");
  const etExprSDK = sdk.init("localhost", 9999, "");

evaluateExpression(expression: string): Promise<string>

|Name|Type|Required|Default|Description| |:---|:---|:---|:---|:---| |expression|string|true|--|Expression to be evaluated.|

Example

  etExprSDK.evaluateExpression("4==2") // returns false

pmt(interestRate: number, loanTerm: number, loanAmount: number): Promise<string>

This method calculates the repayment amount based on the given loan amount, interest rate, and loan term.

|Name|Type|Required|Default|Description| |:---|:---|:---|:---|:---| |interestRate|number|true|--|interestRate -- value that represents monthly interestRate, e.g. 5/100/12| |loanTerm|number|true|--|Total number of month. e.g., 60 | |loanAmount|number|true|--|The principal amount offered as loan amount. e.g., 100000|

Example

  etExprSDK.pmt(5/100/12, 5 * 12, 100000) // returns 1887

duration(dateExpr: string): Promise<string>

This method calculates the duration lapsed between the start date and end date in years months days pattern.

|Name|Type|Required|Default|Description| |:---|:---|:---|:---|:---| |dateExpr|string|true|--|A string with date expression in DDMMYYYY, e.g., "21-11-2022 - 21-11-1960", "21/11/2022 - 21/11/1960", "21.11.2022 - 21.11.1960" |

Example

  etExprSDK.duration("21-11-2022 - 21-11-1960") // returns 62 years, 0 month, 0 day

Release Notes & Breaking Changes

License

Contributing