Skip to content

Commit f83a47e

Browse files
committed
Documentation comments
1 parent 7bf0005 commit f83a47e

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

scripts/versionNumbers.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ writeFileSync(
88
join(cwd(), "src/versionNumbers.ts"),
99
`// AUTOGENERATED. DO NOT MODIFY.
1010
11+
/**
12+
* @internal
13+
*/
1114
export const versionNumbers = ${JSON.stringify(PackageJSON.version.split("."))};`
1215
);

src/float-toolkit.module.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { NgModule } from "@angular/core";
22

33
import { FloatToolkit } from "./float-toolkit.service";
44

5+
/**
6+
* Exports the `FloatToolkit` injectable (service).
7+
*/
58
@NgModule({
69
providers: [FloatToolkit],
710
})

src/float-toolkit.service.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,33 @@ import FloatToolkitCore from "@float-toolkit/core";
33

44
import { versionNumbers } from "./versionNumbers";
55

6+
/**
7+
* An Angular injectable (service) that implements FloatToolkit methods and an `output` property.
8+
*
9+
* @example
10+
* import { FloatToolkit } from "@float-toolkit/angular";
11+
*
12+
* \@Component({...})
13+
* export class SumComponent {
14+
* constructor(private ft: FloatToolkit) {}
15+
* }
16+
*/
617
@Injectable({ providedIn: "root" })
718
class FloatToolkit {
819
private readonly ft = new FloatToolkitCore();
920
private _output = 0;
1021

22+
/**
23+
* A reactive state property containing the returned value of the last method called.
24+
*/
1125
get output(): number {
1226
return this._output;
1327
}
1428

29+
/**
30+
* An integer between 1 and 17.
31+
* Defines the precision (number of decimals) to use by default, if the precision is not specified in the method itself.
32+
*/
1533
get defaultPrecision(): FloatToolkit.Precision {
1634
return this.ft.defaultPrecision;
1735
}
@@ -20,6 +38,9 @@ class FloatToolkit {
2038
this.ft.defaultPrecision = newPrecision;
2139
}
2240

41+
/**
42+
* The options object used in the service.
43+
*/
2344
get options(): FloatToolkit.Options {
2445
return this.ft.options;
2546
}
@@ -69,17 +90,35 @@ class FloatToolkit {
6990
return result;
7091
}
7192

93+
/**
94+
* Resets the output to 0.
95+
*/
7296
resetOutput(): void {
7397
this._output = 0;
7498
}
7599
}
76100

77101
namespace FloatToolkit {
102+
/**
103+
* An integer between 1 and 17, which can be used as the default precision for the `FloatToolkit` service.
104+
*/
78105
export type Precision = FloatToolkitCore.Precision;
106+
107+
/**
108+
* Options that can be set to modify the behavior of the `FloatToolkit` service.
109+
*/
79110
export interface Options extends FloatToolkitCore.Options {}
111+
112+
/**
113+
* An object containing the version of a FloatToolkit package.
114+
*/
80115
export interface Version extends FloatToolkitCore.Version {}
81116

117+
/**
118+
* Contains the version of `@float-toolkit/core` used by the Angular service.
119+
*/
82120
export const CORE_VERSION: Version = FloatToolkitCore.VERSION;
121+
83122
export const VERSION: Version = {
84123
get full() {
85124
return versionNumbers.join(".");

0 commit comments

Comments
 (0)