@bodil/core 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/fun.d.ts CHANGED
@@ -14,3 +14,9 @@ export declare function id<A>(value: A): A;
14
14
  * A function which does nothing and returns `void`.
15
15
  */
16
16
  export declare function nop(): void;
17
+ /**
18
+ * A function which applies the `+` operator to its arguments.
19
+ */
20
+ export declare function sum(a: number, b: number): number;
21
+ export declare function sum(a: bigint, b: bigint): bigint;
22
+ export declare function sum(a: string, b: string): string;
package/dist/fun.js CHANGED
@@ -20,4 +20,9 @@ export function id(value) {
20
20
  export function nop() {
21
21
  // nop
22
22
  }
23
+ export function sum(a, b) {
24
+ // @ts-ignore
25
+ // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
26
+ return a + b;
27
+ }
23
28
  //# sourceMappingURL=fun.js.map
package/dist/fun.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"fun.js","sourceRoot":"","sources":["../src/fun.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,UAAU,MAAM,CAAI,KAAQ;IAC9B,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,EAAE,CAAI,KAAQ;IAC1B,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,GAAG;IACf,MAAM;AACV,CAAC"}
1
+ {"version":3,"file":"fun.js","sourceRoot":"","sources":["../src/fun.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,UAAU,MAAM,CAAI,KAAQ;IAC9B,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,EAAE,CAAI,KAAQ;IAC1B,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,GAAG;IACf,MAAM;AACV,CAAC;AAQD,MAAM,UAAU,GAAG,CAAqC,CAAI,EAAE,CAAI;IAC9D,aAAa;IACb,qEAAqE;IACrE,OAAO,CAAC,GAAG,CAAC,CAAC;AACjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bodil/core",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "My TypeScript standard library",
5
5
  "repository": {
6
6
  "type": "git",
package/src/fun.ts CHANGED
@@ -3,6 +3,8 @@
3
3
  * @module
4
4
  */
5
5
 
6
+ import { OperatorComparable } from "./order";
7
+
6
8
  /**
7
9
  * Create a function that always returns `value`.
8
10
  */
@@ -23,3 +25,15 @@ export function id<A>(value: A): A {
23
25
  export function nop(): void {
24
26
  // nop
25
27
  }
28
+
29
+ /**
30
+ * A function which applies the `+` operator to its arguments.
31
+ */
32
+ export function sum(a: number, b: number): number;
33
+ export function sum(a: bigint, b: bigint): bigint;
34
+ export function sum(a: string, b: string): string;
35
+ export function sum<A extends number | bigint | string>(a: A, b: A): A {
36
+ // @ts-ignore
37
+ // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
38
+ return a + b;
39
+ }