-
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 (#529)
- Loading branch information
1 parent
601df51
commit 9ae09c4
Showing
2 changed files
with
6 additions
and
36 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,14 @@ no problem handling this. | |
**Command:** `deno run ./remote.ts` | ||
|
||
```ts | ||
/** | ||
* remote.ts | ||
*/ | ||
import { | ||
add, | ||
multiply, | ||
} from "https://x.nest.land/[email protected]/source/index.js"; | ||
import { add, multiply } from "https://deno.land/x/[email protected]/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 +81,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 +105,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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,10 +40,7 @@ clean separation between dev and production dependencies. | |
* This module re-exports the required methods | ||
* from the dependant remote Ramda module. | ||
*/ | ||
export { | ||
add, | ||
multiply, | ||
} from "https://x.nest.land/[email protected]/source/index.js"; | ||
export { add, multiply } from "https://deno.land/x/[email protected]/mod.ts"; | ||
``` | ||
|
||
This example has the same functionality as the | ||
|