Skip to content

Commit

Permalink
move from x.nest.land to deno.land/x (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisjofrank authored Jul 4, 2024
1 parent 601df51 commit 9ae09c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 36 deletions.
37 changes: 5 additions & 32 deletions runtime/manual/basics/modules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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;
}
Expand All @@ -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
Expand Down
5 changes: 1 addition & 4 deletions runtime/tutorials/manage_dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9ae09c4

Please sign in to comment.