Skip to content

Commit

Permalink
Merge pull request #4 from warerebel/issue-3
Browse files Browse the repository at this point in the history
Fixed documentation errors
  • Loading branch information
warerebel committed Mar 30, 2022
2 parents 589c4f8 + 235e1b2 commit b670d7c
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 30 deletions.
5 changes: 5 additions & 0 deletions Changelog
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.1] - 2022-03-30
### Fixed
- README: Some items that should be code were documented as JSON
- index.d.ts: exported model definitions

## [1.0.0] - 2022-03-30
### Added
- function: harmonicAverage
Expand Down
51 changes: 26 additions & 25 deletions README.md
Expand Up @@ -24,7 +24,7 @@ npm install openlr-translate-sections
# Import the module
For commonjs:
```javascript
const { validateInput, translate, baselineLength, harmonicAverage, translationInput } = require("openlr-translate-sections");
const { validateInput, translate, baselineLength, harmonicAverage } = require("openlr-translate-sections");
```
For typescript:
```typescript
Expand All @@ -39,38 +39,38 @@ We describe this depicted relationship with a `translationInput` object:

```typescript
const inputObject: translationInput = {
"cost": 2000, // Total OpenLR section length - For reference only, is not used by the module
"openLR": "xyz", // OpenLR reference - For reference only, is not used by the module
"fromModel": [
cost: 2000, // Total OpenLR section length - For reference only, is not used by the module
openLR: "xyz", // OpenLR reference - For reference only, is not used by the module
fromModel: [
{
"linkid": "Section1",
"length": 800,
"value": 70
linkid: "Section1",
length: 800,
value: 70
},
{
"linkid": "Section2",
"length": 1200,
"value": 110
linkid: "Section2",
length: 1200,
value: 110
}
],
"toModel": [
toModel: [
{
"linkid": "{abcd}",
"length": 600,
"link": [],
"endChainage": []
linkid: "{abcd}",
length: 600,
link: [],
endChainage: []
},
{
"linkid": "{efgh}",
"length": 650,
"link": [],
"endChainage": []
linkid: "{efgh}",
length: 650,
link: [],
endChainage: []
},
{
"linkid": "{ijkl}",
"length": 750,
"link": [],
"endChainage": []
linkid: "{ijkl}",
length: 750,
link: [],
endChainage: []
}
]
}
Expand Down Expand Up @@ -103,7 +103,7 @@ The final `translatedWithValues` output will be:
{
"linkid": "{efgh}",
"length": 650,
"value": 97.7
"value": 93.6
},
{
"linkid": "{ijkl}",
Expand All @@ -127,7 +127,8 @@ try{
const adjustedInput = baselineLength(inputobject); // We now know for certain the object is ready for translation
const translatedOuput = translate(adjustedInput);
} catch(error) {
console.log(error.message); // If out of tolerance - "The toModel length varies outside of tolerance from the fromModel length"
if(error instanceOf Error)
console.log(error.message); // If out of tolerance - "The toModel length varies outside of tolerance from the fromModel length"
}
```

Expand Down
1 change: 1 addition & 0 deletions index.ts
@@ -1,3 +1,4 @@
export * from "./src/validate";
export * from "./src/translate";
export * from "./src/harmonicAverage";
export * from "./src/models";
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions package.json
@@ -1,12 +1,15 @@
{
"name": "openlr-translate-sections",
"version": "1.0.0",
"version": "1.0.1",
"description": "Translate sections from OpenLR linear references to a target mapping network model",
"keywords": ["openlr", "transport models"],
"keywords": [
"openlr",
"transport models"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"lint": "eslint **/*.ts",
"lint": "eslint **/*.ts",
"prepare": "tsc",
"build": "tsc",
"test": "mocha -r ts-node/register **/*.spec.ts",
Expand Down

0 comments on commit b670d7c

Please sign in to comment.