Skip to content

Commit

Permalink
v 0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
5anthosh committed Nov 14, 2019
1 parent 1c734a2 commit 83399a0
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 15 deletions.
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#### 0.3.2

- 14/11/2019
- Fix issue [#2](https://github.com/5anthosh/fcal/issues/2)
- Allow Map in Fcal.UseVariable and Fcal.UseContants
- Allow Objects in plugin addition
- Give Unary operation higer precedance than Conversion(units, number system)
- Fix Typo arbity to arity
- Use Map instead of Objects for storing units, functions and variables

#### 0.3.1

- Support number system conversion
- Helper function eval
- new Sigma function
- Use symboltable internally to validate unit, function, constants, variables and phrases

#### 0.3.0

- Infinity
- Various number system
- Support plugins

#### 0.2.1

- 18/10/2019
- Hot fix for invalid units

#### 0.2.0

- 18/10/2019
- temperature unit, Better error reporting, Expontial in numbers

#### 0.1.0

- 14/10/2019
- Initial release
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

> Fcaljs is an extensive math expression evaluator library for JavaScript and Node.js.
> Using fcal, you can perform basic arithmetic, percentage operations with precision.
> It features a flexible expression parser with a large set of built-in units, functions and constants
> It features a flexible expression parser with a large set of built-in units, functions and constants.
> Inspired from [Numi](https://numi.app)
## Features

Expand Down Expand Up @@ -58,6 +59,8 @@ fcal.evaluate('1.2 nsec + 3 week in sec'); // 1814400.0000000012 Seconds

// Various number system
fcal.evaluate('0b1010011 day + 45'); // 128 Days

fcal.evaluate('23.44 kmh in oct'); // 0o27.341217270243656051 km/h
```

## Install
Expand Down
15 changes: 8 additions & 7 deletions jestconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"transform": {
"^.+\\.(t|j)sx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
"collectCoverage": true
}
"transform": {
"^.+\\.(t|j)sx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
"collectCoverage": true,
"verbose": true
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "fcal",
"version": "0.3.1",
"version": "0.3.2",
"description": "Math expression evaluator",
"main": "lib/fcal.js",
"types": "lib/fcal.d.ts",
"scripts": {
"test": "jest --verbose --config jestconfig.json",
"build": "npm run browser && rm -rf lib && tsc",
"test": "jest --config jestconfig.json",
"build": "rm -rf lib && tsc",
"browser": "tsc --target es5 --outDir es5 && browserify es5/fcal.js --standalone fcal -o dist/fcal.js && browserify -p tinyify es5/fcal.js --standalone fcal -o dist/fcal.min.js && rm -rf es5",
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
"lint": "tslint -p tsconfig.json",
"prepare": "npm run build",
"prepare": "npm run build && npm run browser",
"version": "npm run format && git add -A src",
"postversion": "git push && git push --tags",
"prepublishOnly": "npm test && npm run lint",
Expand Down Expand Up @@ -51,4 +51,4 @@
"math",
"expression"
]
}
}
5 changes: 3 additions & 2 deletions src/__test__/ns.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ test('Invalid number literal (Number system)', () => {
});

test('Number system conversion', () => {
expect(Fcal.eval('342 cm in bin').toString()).toStrictEqual('0b101010110 Centimeters');
expect(Fcal.eval('-342 cm in bin').toString()).toStrictEqual('-0b101010110 Centimeters');
expect(Fcal.eval('0b110010111011 % in hex').toString()).toStrictEqual('% 0xcbb');
expect(Fcal.eval('(3 + 0.14) in oct').toString()).toStrictEqual('0o3.1075341217270243656');
expect(Fcal.eval('0o21436 sec as bin').toString()).toStrictEqual('0b10001100011110 Seconds');
expect(Fcal.eval('0xD7A day as decimal').toString()).toStrictEqual('3450 Days');
expect(Fcal.eval('-0xD7A day as decimal').toString()).toStrictEqual('-3450 Days');
expect(Fcal.eval('---23.44 kmh as oct').toString()).toStrictEqual('-0o27.341217270243656051 km/h');
});

0 comments on commit 83399a0

Please sign in to comment.