@temperlang/core 0.1.0 → 0.2.0

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 (3) hide show
  1. package/index.js +5 -7
  2. package/package.json +1 -1
  3. package/regex.js +3 -1
package/index.js CHANGED
@@ -8,7 +8,7 @@ export function stringIsEmpty(s) {
8
8
 
9
9
  // Implements extension method String::split
10
10
  export function stringSplit(s, separator) {
11
- return s.split(separator).map((s) => s);
11
+ return separator ? s.split(separator).map((s) => s) : Array.from(s);
12
12
  }
13
13
 
14
14
  /**
@@ -755,7 +755,7 @@ export function mappedLength(map) {
755
755
  export function mappedGet(map, key) {
756
756
  const result = map.get(key);
757
757
  // TODO Under compiler-error-free Temper, could undefined values get set?
758
- // TODO Would Map<?, Void> be impossible to feed once we get checks in place?
758
+ // TODO Would Map<?, Void> be impossible to feed once we get checks in place?
759
759
  if (result === undefined) {
760
760
  bubble();
761
761
  }
@@ -1137,11 +1137,9 @@ export function print(a) {
1137
1137
  console.log("%s", a);
1138
1138
  return void 0;
1139
1139
  }
1140
- export function nexter(f) {
1141
- return (
1142
- (generator) => () =>
1143
- generator.next()
1144
- )(f());
1140
+
1141
+ export function adaptGenerator(generator) {
1142
+ return () => generator.next();
1145
1143
  }
1146
1144
 
1147
1145
  // We might customize this in the future, but actual global console works today.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temperlang/core",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Runtime support for JS generated by Temper",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/regex.js CHANGED
@@ -20,7 +20,9 @@ function compiledRegexCompiledFindEx(_, compiled, text, regexRefs) {
20
20
  if (match === null) {
21
21
  return undefined;
22
22
  }
23
- const { groups, indices: { groups: indexGroups } } = match;
23
+ const { groups: groupsMaybe, indices: { groups: indexGroupsMaybe } } = match;
24
+ const groups = groupsMaybe || {};
25
+ const indexGroups = indexGroupsMaybe || [];
24
26
  // Find the begin indices in code points for all matched groups.
25
27
  const rawBegins = [];
26
28
  const defaultFull = !("full" in groups);