@chrismo/superkit 1.2.0 → 1.3.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.
@@ -235,9 +235,9 @@ super -I string.spq -s -c 'values sk_urldecode("%2Ftavern%20test")' -
235
235
  op sk_decode_seg s: (
236
236
  len(s) == 0
237
237
  ? s
238
- : (is_error(hex(s[1:3]))
238
+ : (is_error(hex(s[0:2]))
239
239
  ? s
240
- : hex(s[1:3])::string + s[3:])
240
+ : f'{hex(s[0:2])::string}{s[2:]}')
241
241
  )
242
242
 
243
243
  op sk_urldecode url: (
@@ -114,21 +114,20 @@ fn skdoc_mid(): (
114
114
 
115
115
  fn sk_mid(s, start, n): (sk_slice(s, sk_clamp(start, 0, len(s)), sk_clamp(start, 0, len(s)) + sk_clamp(n, 0, len(s))))
116
116
 
117
- -- TODO: skdoc_urldecode
118
-
119
- -- URL Decoder for SuperDB
120
- -- Usage: super -I urldecode.spq -s -c 'values sk_urldecode(this)' - <<< '"%%2Ftavern%%20test"'
121
- -- Or inline the definitions in your query
122
-
123
- -- Helper operator to decode a single segment after splitting on %%
124
- -- If the segment starts with valid 2-char hex, converts it to the character
125
- -- Otherwise returns the segment as-is
117
+ fn skdoc_urldecode(): (
118
+ cast(
119
+ {name:"sk_urldecode",
120
+ type:"op",
121
+ desc:"URL-decodes a percent-encoded string. Splits on %%, decodes each hex-encoded segment, and joins back together.",
122
+ args:[{name:"url",desc:"The URL-encoded string to decode."}],
123
+ examples:[{i:"'%%2Fhello%%20world' | sk_urldecode this",o:"'/hello world'"}]}, <skdoc>)
124
+ )
126
125
  op sk_decode_seg s: (
127
126
  len(s) == 0
128
127
  ? s
129
- : (is_error(hex(s[1:3]))
128
+ : (is_error(hex(s[0:2]))
130
129
  ? s
131
- : hex(s[1:3])::string + s[3:])
130
+ : f'{hex(s[0:2])::string}{s[2:]}')
132
131
  )
133
132
 
134
133
  -- Main URL decoder operator
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrismo/superkit",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "SuperDB toolkit — docs, recipes, grok patterns, and CLI tools for the super binary",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",