Skip to content

Commit

Permalink
move from x.nest.land to deno.land/x
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisjofrank committed Jul 4, 2024
1 parent 601df51 commit a170e42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 30 deletions.
34 changes: 5 additions & 29 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,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
Expand All @@ -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;
}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion runtime/tutorials/manage_dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ clean separation between dev and production dependencies.
export {
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";
```

This example has the same functionality as the
Expand Down

0 comments on commit a170e42

Please sign in to comment.