functionalscript 0.3.10 → 0.3.12

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.
Files changed (54) hide show
  1. package/README.md +1 -0
  2. package/bnf/djs/module.f.d.ts +11 -0
  3. package/bnf/djs/module.f.js +6 -0
  4. package/bnf/djs/test.f.d.ts +1 -0
  5. package/bnf/djs/test.f.js +221 -0
  6. package/bnf/module.f.d.ts +135 -0
  7. package/bnf/module.f.js +142 -0
  8. package/bnf/test.f.d.ts +65 -0
  9. package/bnf/test.f.js +368 -0
  10. package/crypto/prime_field/module.f.d.ts +1 -4
  11. package/crypto/secp/module.f.d.ts +2 -2
  12. package/dev/test/module.f.js +2 -1
  13. package/fsc/module.f.js +5 -6
  14. package/fsm/module.f.d.ts +9 -9
  15. package/fsm/module.f.js +13 -22
  16. package/html/module.f.js +1 -2
  17. package/issues/31-json.f.d.ts +1 -0
  18. package/issues/31-json.f.js +241 -0
  19. package/js/tokenizer/module.f.js +6 -1
  20. package/nanvm-lib/tests/test.f.d.ts +4 -0
  21. package/nanvm-lib/tests/test.f.js +5 -7
  22. package/nodejs/version/module.f.d.ts +1 -1
  23. package/package.json +1 -1
  24. package/text/module.f.js +3 -3
  25. package/text/utf16/module.f.d.ts +11 -5
  26. package/text/utf16/module.f.js +2 -0
  27. package/text/utf16/test.f.js +8 -1
  28. package/types/btree/find/module.f.d.ts +2 -2
  29. package/types/btree/remove/module.f.d.ts +4 -4
  30. package/types/btree/remove/module.f.js +9 -11
  31. package/types/btree/remove/test.f.js +2 -2
  32. package/types/btree/set/module.f.d.ts +3 -3
  33. package/types/byte_set/test.f.js +31 -31
  34. package/types/function/module.f.d.ts +1 -1
  35. package/types/range_map/module.f.d.ts +79 -2
  36. package/types/range_map/module.f.js +49 -2
  37. package/types/range_map/test.f.d.ts +1 -0
  38. package/types/range_map/test.f.js +76 -33
  39. package/types/result/module.f.d.ts +48 -1
  40. package/types/result/module.f.js +40 -2
  41. package/types/result/test.f.d.ts +4 -0
  42. package/types/result/test.f.js +18 -0
  43. package/types/sorted_list/module.f.js +8 -7
  44. package/types/sorted_set/module.f.d.ts +28 -0
  45. package/types/sorted_set/test.f.d.ts +1 -0
  46. package/types/sorted_set/test.f.js +19 -0
  47. package/types/string/module.f.d.ts +17 -0
  48. package/types/string/module.f.js +17 -0
  49. package/types/string/test.f.d.ts +1 -0
  50. package/types/string/test.f.js +15 -0
  51. package/types/string_set/module.f.d.ts +21 -0
  52. package/types/string_set/module.f.js +21 -0
  53. package/types/string_set/test.f.d.ts +1 -0
  54. package/types/string_set/test.f.js +18 -1
@@ -1,3 +1,20 @@
1
+ /**
2
+ * Utility functions for working with strings and lists of strings.
3
+ *
4
+ * @module
5
+ *
6
+ * @example
7
+ *
8
+ * ```js
9
+ * import { join, concat, repeat, cmp } from './module.f.ts'
10
+ *
11
+ * const words = ['hello', 'world']
12
+ * join(' ')(words) // 'hello world'
13
+ * concat(words) // 'helloworld'
14
+ * repeat('abc')(3) // 'abcabcabc'
15
+ * cmp('apple')('banana') // -1
16
+ * ```
17
+ */
1
18
  import { reduce as listReduce, repeat as listRepeat } from "../list/module.f.js";
2
19
  import { compose } from "../function/module.f.js";
3
20
  import { unsafeCmp } from "../function/compare/module.f.js";
@@ -1,4 +1,5 @@
1
1
  declare const _default: {
2
+ example: () => void;
2
3
  join: {
3
4
  0: () => void;
4
5
  1: () => void;
@@ -1,6 +1,21 @@
1
1
  import { join, concat, repeat, cmp } from "./module.f.js";
2
2
  import { repeat as repeatList } from "../list/module.f.js";
3
3
  export default {
4
+ example: () => {
5
+ const words = ['hello', 'world'];
6
+ if (join(' ')(words) !== 'hello world') {
7
+ throw 0;
8
+ }
9
+ if (concat(words) !== 'helloworld') {
10
+ throw 1;
11
+ }
12
+ if (repeat('abc')(3) !== 'abcabcabc') {
13
+ throw 2;
14
+ }
15
+ if (cmp('apple')('banana') !== -1) {
16
+ throw 3;
17
+ }
18
+ },
4
19
  join: {
5
20
  0: () => {
6
21
  const result = join('/')([]);
@@ -1,3 +1,24 @@
1
+ /**
2
+ * A set of strings implemented as a B-Tree.
3
+ *
4
+ * @module
5
+ *
6
+ * @example
7
+ *
8
+ * ```js
9
+ * import { set, contains, remove, fromValues, values, empty } from './module.d.ts';
10
+ *
11
+ * let mySet = fromValues(['apple', 'banana', 'cherry']);
12
+ * if (!contains('banana')(mySet)) { throw '1' }
13
+ * if (contains('date')(mySet)) { throw '2' }
14
+ *
15
+ * mySet = set('date')(mySet);
16
+ * if (!contains('date')(mySet)) { throw '3' }
17
+ *
18
+ * mySet = remove('banana')(mySet);
19
+ * if (contains('banana')(mySet)) { throw '4' }
20
+ * ```
21
+ */
1
22
  import type { Tree } from '../btree/types/module.f.ts';
2
23
  import { type List } from '../list/module.f.ts';
3
24
  export declare const values: (s: StringSet) => List<string>;
@@ -1,3 +1,24 @@
1
+ /**
2
+ * A set of strings implemented as a B-Tree.
3
+ *
4
+ * @module
5
+ *
6
+ * @example
7
+ *
8
+ * ```js
9
+ * import { set, contains, remove, fromValues, values, empty } from './module.d.ts';
10
+ *
11
+ * let mySet = fromValues(['apple', 'banana', 'cherry']);
12
+ * if (!contains('banana')(mySet)) { throw '1' }
13
+ * if (contains('date')(mySet)) { throw '2' }
14
+ *
15
+ * mySet = set('date')(mySet);
16
+ * if (!contains('date')(mySet)) { throw '3' }
17
+ *
18
+ * mySet = remove('banana')(mySet);
19
+ * if (contains('banana')(mySet)) { throw '4' }
20
+ * ```
21
+ */
1
22
  import * as btree from "../btree/module.f.js";
2
23
  import { find, isFound } from "../btree/find/module.f.js";
3
24
  import { remove as btreeRemove } from "../btree/remove/module.f.js";
@@ -1,4 +1,5 @@
1
1
  declare const _default: {
2
+ example: () => void;
2
3
  contains: () => void;
3
4
  remove: () => void;
4
5
  };
@@ -1,5 +1,22 @@
1
- import { contains, remove, set } from "./module.f.js";
1
+ import { contains, fromValues, remove, set } from "./module.f.js";
2
2
  export default {
3
+ example: () => {
4
+ let mySet = fromValues(['apple', 'banana', 'cherry']);
5
+ if (!contains('banana')(mySet)) {
6
+ throw '1';
7
+ }
8
+ if (contains('date')(mySet)) {
9
+ throw '2';
10
+ }
11
+ mySet = set('date')(mySet);
12
+ if (!contains('date')(mySet)) {
13
+ throw '3';
14
+ }
15
+ mySet = remove('banana')(mySet);
16
+ if (contains('banana')(mySet)) {
17
+ throw '4';
18
+ }
19
+ },
3
20
  contains: () => {
4
21
  const r = set('hello')(null);
5
22
  if (!contains('hello')(r)) {