FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TypeScript-Starter/examples/basic-usage.ts at main · NeaByteLab/TypeScript-Starter · GitHub
NeaByteLab
/
TypeScript-Starter
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
TypeScript-Starter
/
examples
/
basic-usage.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
61 lines (51 loc) · 1.58 KB
Breadcrumbs
TypeScript-Starter
/
examples
/
basic-usage.ts
Copy path
File metadata and controls
61 lines (51 loc) · 1.58 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* Basic usage example
*
@module
examples/basic-usage
*/
import
{
exampleFunction
,
ExampleClass
}
from
'@/index'
import
{
isNotEmpty
,
createSuccessResult
,
createErrorResult
,
delay
}
from
'@/utils'
/**
* Demonstrate basic functionality
*/
const
demonstrateBasicUsage
=
(
)
:
void
=>
{
console
.
log
(
'=== Basic Usage Example ==='
)
// Function usage
const
result
=
exampleFunction
(
'hello world'
)
console
.
log
(
'Function result:'
,
result
)
// Class usage
const
instance
=
new
ExampleClass
(
'test value'
)
const
classResult
=
instance
.
getValue
(
)
console
.
log
(
'Class result:'
,
classResult
)
// Utility usage
const
validationResult
=
isNotEmpty
(
'valid string'
)
console
.
log
(
'Validation result:'
,
validationResult
)
const
successResult
=
createSuccessResult
(
{
message
:
'Success!'
}
)
console
.
log
(
'Success result:'
,
successResult
)
const
errorResult
=
createErrorResult
<
string
>
(
'Error occurred'
)
console
.
log
(
'Error result:'
,
errorResult
)
}
/**
* Demonstrate async functionality
*/
const
demonstrateAsyncUsage
=
async
(
)
:
Promise
<
void
>
=>
{
console
.
log
(
'\n=== Async Usage Example ==='
)
console
.
log
(
'Starting delay...'
)
await
delay
(
1000
)
console
.
log
(
'Delay completed!'
)
}
/**
* Main example function
*/
const
main
=
async
(
)
:
Promise
<
void
>
=>
{
try
{
demonstrateBasicUsage
(
)
await
demonstrateAsyncUsage
(
)
console
.
log
(
'\n=== Example completed successfully ==='
)
}
catch
(
error
)
{
console
.
error
(
'Example failed:'
,
error
)
}
}
// Run the example if this file is executed directly
if
(
import
.
meta
.
url
===
`file://
${
process
.
argv
[
1
]
}
`
)
{
main
(
)
.
catch
(
console
.
error
)
}
Back
|
FazBrowse Home
|
New Git URL