@lotics/app-sdk 0.124.0 → 0.124.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/index.js CHANGED
@@ -2695,6 +2695,8 @@ __export(expression_string_exports, {
2695
2695
  numberToWords: () => numberToWords,
2696
2696
  padEnd: () => padEnd,
2697
2697
  padStart: () => padStart,
2698
+ removeChars: () => removeChars,
2699
+ removeSpaces: () => removeSpaces,
2698
2700
  repeat: () => repeat,
2699
2701
  replace: () => replace,
2700
2702
  replaceAll: () => replaceAll,
@@ -3167,6 +3169,29 @@ function replaceAll(str, search, replacement) {
3167
3169
  assertStringLength("replaceAll", str.length + matches * (replacement.length - search.length));
3168
3170
  return str.split(search).join(replacement);
3169
3171
  }
3172
+ function removeChars(text2, chars) {
3173
+ if (text2 == null) return "";
3174
+ if (typeof text2 !== "string") {
3175
+ throw new ExpressionArgumentError("removeChars: expected string, got " + typeof text2);
3176
+ }
3177
+ if (typeof chars !== "string") {
3178
+ throw new ExpressionArgumentError("removeChars: chars must be a string");
3179
+ }
3180
+ if (chars === "") return text2;
3181
+ const removed = new Set(chars);
3182
+ let kept = "";
3183
+ for (const char of text2) {
3184
+ if (!removed.has(char)) kept += char;
3185
+ }
3186
+ return kept;
3187
+ }
3188
+ function removeSpaces(text2) {
3189
+ if (text2 == null) return "";
3190
+ if (typeof text2 !== "string") {
3191
+ throw new ExpressionArgumentError("removeSpaces: expected string, got " + typeof text2);
3192
+ }
3193
+ return text2.replace(/\s/gu, "");
3194
+ }
3170
3195
  function matchCount(str, search) {
3171
3196
  if (search === "") return Math.max(0, str.length - 1);
3172
3197
  let matches = 0;
@@ -7343,6 +7368,8 @@ var HELPER_COST = {
7343
7368
  capitalize: "builds",
7344
7369
  replace: "builds",
7345
7370
  replaceAll: "builds",
7371
+ removeChars: "builds",
7372
+ removeSpaces: "builds",
7346
7373
  startsWith: "reads",
7347
7374
  endsWith: "reads",
7348
7375
  substring: "builds",
package/docs/workflows.md CHANGED
@@ -496,7 +496,7 @@ full menu by category, so a miss is one informed retry.
496
496
  | **Type / null** | `isNull`, `isNotNull`, `isEmpty`, `isString`, `isNumber`, `isBoolean`, `isArray`, `isObject`, `coalesce`, `toNumber`, `toFigure`, `toString`, `typeOf`, `parseJson`, `toJson` |
497
497
  | **Array** | `size`, `first`, `requireFirst`, `last`, `nth`, `at`, `slice`, `includes`, `filter`, `find`, `some`, `every`, `pluck`, `sortBy`, `groupBy`, `countBy`, `unique`, `uniqueBy`, `compact`, `flatten`, `reverse`, `concat`, `difference`, `differenceBy`, `intersection`, `intersectionBy`, `list`, `range`, `reduce` |
498
498
  | **Number** | `sum`, `sumBy`, `mean`, `meanBy`, `min`, `max`, `minBy`, `maxBy`, `round`, `ceil`, `floor`, `abs`, `mod`, `pow`, `sqrt`, `clamp`, `percentage` |
499
- | **String** | `upper`, `lower`, `capitalize`, `trim`, `contains`, `startsWith`, `endsWith`, `replace`, `replaceAll`, `substring`, `length`, `split`, `join`, `padStart`, `padEnd`, `uuidFrom(text)` (the same UUID for the same text), `formatNumber(value, decimals)` (fixed-decimal, ungrouped), `formatDecimal(value, decimals, locale)` (grouped for a reader — `formatDecimal(151000, 0, "vi-VN")` → `151.000`), `numberToWords(x, lang?)` (`"vi"` or `"en"`) |
499
+ | **String** | `upper`, `lower`, `capitalize`, `trim`, `contains`, `startsWith`, `endsWith`, `replace`, `replaceAll`, `removeChars(text, chars)` (without every character that occurs in `chars`), `removeSpaces(text)` (without any whitespace), `substring`, `length`, `split`, `join`, `padStart`, `padEnd`, `uuidFrom(text)` (the same UUID for the same text), `formatNumber(value, decimals)` (fixed-decimal, ungrouped), `formatDecimal(value, decimals, locale)` (grouped for a reader — `formatDecimal(151000, 0, "vi-VN")` → `151.000`), `numberToWords(x, lang?)` (`"vi"` or `"en"`) |
500
500
  | **Object** | `keys`, `values`, `entries`, `get`, `pick`, `omit`, `merge`, `nonNullKeys` |
501
501
  | **Date** | `now`, `formatDate`, `parseDate`, `addDays`, `subDays`, `addHours`, `subHours`, `addMinutes`, `subMinutes`, `startOfDay`, `endOfDay`, `differenceInCalendarDays`, `differenceInHours`, `differenceInMinutes`, `isBefore`, `isAfter`, `isSameDay`, `isToday`, `isWithinRange`, `meetsBounds` |
502
502
  | **Other** | `formatCurrency(amount, locale, currency)`, `randomNumber(len)`, `randomAlphaNumeric(len)`, `sample(items)`, `current_member_in_any_group(["grp_…"])`, `current_member_stands_in_for([memberId])`, `current_member_stands_in_for_any_group(["grp_…"])` |
@@ -797,8 +797,9 @@ The rules that are easy to get wrong because the failing code looks correct.
797
797
  **items** (`xs.push(item)`) works on a bare `[]` seed.
798
798
  - **Expressions are bounded.** A helper that builds an array — `range`, `list`, `flatten`,
799
799
  `concat` of arrays, `split`'s parts — makes at most 100,000 elements, and a callback helper
800
- takes an array of at most 100,000. `join`, `replaceAll`, `padStart`, `padEnd`, `toString`,
801
- `toJson` and a template string write at most 10,000,000 characters; `randomNumber` /
800
+ takes an array of at most 100,000. `join`, `replaceAll`, `padStart`, `padEnd`,
801
+ `toString`, `toJson` and a template string write at most 10,000,000 characters;
802
+ `randomNumber` /
802
803
  `randomAlphaNumeric` take a length of at most 1,000. Past one of those the call throws an
803
804
  expression error, which `try`/`catch` catches, and so does an expression whose value would write
804
805
  more than 67,108,864 characters of JSON, or a step whose result would take what the run keeps
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/app-sdk",
3
- "version": "0.124.0",
3
+ "version": "0.124.1",
4
4
  "description": "The SDK a Lotics custom-code app reads and writes through — typed hooks over the host bridge, cell readers, mount() and AppRouter",
5
5
  "type": "module",
6
6
  "exports": {