Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move from x.nest.land to deno.land/x #529

Merged
merged 2 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/liltest@0.0.5/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
Loading