mirror of
https://github.com/hi-language/hi-language.github.io.git
synced 2026-01-14 00:28:05 +00:00
Refactor: Generalize module import example
This commit is contained in:
@@ -252,10 +252,11 @@ active: !0
|
|||||||
Modules are imported using the \`+\` and \`->\` operators. This allows for destructuring and aliasing of imported members.
|
Modules are imported using the \`+\` and \`->\` operators. This allows for destructuring and aliasing of imported members.
|
||||||
|
|
||||||
\`\`\`javascript
|
\`\`\`javascript
|
||||||
// Import 'sum' and 'multiply' (as 'mul') from a remote module
|
// Import 'block1' and 'block2' (as 'alias2') from a module
|
||||||
+ "npm://hi-lang@0.1/math/utils.hi" -> { sum, multiply: mul }
|
+ "hi-lang@0.1/path/file.hi" -> { block1, block2: alias2 }
|
||||||
|
|
||||||
sum(5, mul(2, 3)) // 11
|
block1()
|
||||||
|
alias2("some value")
|
||||||
\`\`\`
|
\`\`\`
|
||||||
|
|
||||||
## Method Chaining
|
## Method Chaining
|
||||||
|
|||||||
Reference in New Issue
Block a user