-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move from x.nest.land to deno.land/x
- Loading branch information
1 parent
601df51
commit a170e42
Showing
2 changed files
with
6 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,24 +38,14 @@ In this example the `add` and `multiply` functions are imported from a local | |
**Command:** `deno run local.ts` | ||
|
||
```ts | ||
/** | ||
* local.ts | ||
*/ | ||
import { add, multiply } from "./arithmetic.ts"; | ||
|
||
function totalCost(outbound: number, inbound: number, tax: number): number { | ||
return multiply(add(outbound, inbound), tax); | ||
} | ||
|
||
console.log(totalCost(19, 31, 1.2)); | ||
console.log(totalCost(45, 27, 1.15)); | ||
|
||
/** | ||
* Output | ||
* | ||
* 60 | ||
* 82.8 | ||
*/ | ||
console.log(totalCost(19, 31, 1.2)); // 60 | ||
console.log(totalCost(45, 27, 1.15)); // 82.8 | ||
``` | ||
|
||
## Remote Import | ||
|
@@ -71,27 +61,17 @@ no problem handling this. | |
**Command:** `deno run ./remote.ts` | ||
|
||
```ts | ||
/** | ||
* remote.ts | ||
*/ | ||
import { | ||
add, | ||
multiply, | ||
} from "https://x.nest.land/ramda@0.27.0/source/index.js"; | ||
} from "https://deno.land/x/ramda@v0.27.2/mod.ts"; | ||
|
||
function totalCost(outbound: number, inbound: number, tax: number): number { | ||
return multiply(add(outbound, inbound), tax); | ||
} | ||
|
||
console.log(totalCost(19, 31, 1.2)); | ||
console.log(totalCost(45, 27, 1.15)); | ||
|
||
/** | ||
* Output | ||
* | ||
* 60 | ||
* 82.8 | ||
*/ | ||
console.log(totalCost(19, 31, 1.2)); // 60 | ||
console.log(totalCost(45, 27, 1.15)); // 82.8 | ||
``` | ||
|
||
## Export | ||
|
@@ -104,9 +84,6 @@ To do this just add the keyword `export` to the beginning of the function | |
signature as is shown below. | ||
|
||
```ts | ||
/** | ||
* arithmetic.ts | ||
*/ | ||
export function add(a: number, b: number): number { | ||
return a + b; | ||
} | ||
|
@@ -131,7 +108,6 @@ being run: `https://unpkg.com/[email protected]/dist/liltest.js`. | |
### It seems unwieldy to import URLs everywhere. | ||
|
||
> What if one of the URLs links to a subtly different version of a library? | ||
> Isn't it error prone to maintain URLs everywhere in a large project? | ||
The solution is to import and re-export your external libraries in a central | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters