ansuko 1.3.0 → 1.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/README.ja.md CHANGED
@@ -128,6 +128,10 @@ const diff = _.changes(
128
128
  updated,
129
129
  ['name', 'email', 'profile.bio']
130
130
  )
131
+
132
+ // try-catch不要のエラーハンドリング
133
+ const result = _.swallow(() => riskyOperation()) // エラー時はundefined
134
+ const items = _.swallowMap([1, 2, 3], item => processItem(item), true) // エラーを除外
131
135
  ```
132
136
 
133
137
  ### プラグインの使用
@@ -209,6 +213,8 @@ extended.toPointGeoJson([139.7, 35.6])
209
213
  - **`hasOr`** - パスの存在確認、なければデフォルトを返す(深いパス & Promise対応)
210
214
  - **`equalsOr`** - Promise対応の比較とフォールバック、直感的なnil処理
211
215
  - **`changes`** - DB更新用のオブジェクト差分追跡(`profile.tags[1]` のような深いパス & 除外モード対応)
216
+ - **`swallow`** - エラー時にundefinedを返す関数実行(同期/非同期対応)
217
+ - **`swallowMap`** - エラーをundefinedとして扱う配列map(compactモードでエラー除外可)
212
218
 
213
219
  ### 型変換と検証
214
220
 
@@ -331,7 +337,7 @@ npm run build
331
337
 
332
338
  ## 開発
333
339
 
334
- Seraによって開発され、ドキュメント、コードレビュー、技術的な議論でClaude(Anthropic)の支援を受けました。
340
+ テストとドキュメントが苦手なので、壁打ちとドキュメントにClaudeを使ってます。
335
341
 
336
342
  ## ライセンス
337
343
 
package/README.md CHANGED
@@ -102,6 +102,8 @@ const value = _.equalsOr(a, b, defaultValue) // null == undefined
102
102
  - **`hasOr`** - Check if paths exist, return default if missing (supports deep paths & Promises)
103
103
  - **`equalsOr`** - Compare and fallback with intuitive nil handling (Promises supported)
104
104
  - **`changes`** - Track object differences for DB updates (supports deep paths like `profile.tags[1]` & excludes mode)
105
+ - **`swallow`** - Execute function and return undefined on error (sync/async)
106
+ - **`swallowMap`** - Map over array, treating errors as undefined (with optional compact mode)
105
107
 
106
108
  ### Type Conversion & Validation
107
109
 
@@ -203,6 +205,10 @@ const diff = _.changes(
203
205
  updated,
204
206
  ['name', 'email', 'profile.bio']
205
207
  )
208
+
209
+ // Error handling without try-catch
210
+ const result = _.swallow(() => riskyOperation()) // undefined on error
211
+ const items = _.swallowMap([1, 2, 3], item => processItem(item), true) // filter errors
206
212
  ```
207
213
 
208
214
  ### Using Plugins
package/README.zh.md CHANGED
@@ -101,6 +101,8 @@ const value = _.equalsOr(a, b, defaultValue) // null == undefined
101
101
  - **`hasOr`** - 检查路径是否存在,如果缺失则返回默认值(支持深度路径和 Promise)
102
102
  - **`equalsOr`** - 比较并后备,具有直观的 nil 处理(支持 Promise)
103
103
  - **`changes`** - 跟踪对象差异用于数据库更新(支持深度路径如 `profile.tags[1]` 和排除模式)
104
+ - **`swallow`** - 执行函数,出错时返回 undefined(同步/异步支持)
105
+ - **`swallowMap`** - 映射数组,将错误视为 undefined(可选紧凑模式过滤错误)
104
106
 
105
107
  ### 类型转换与验证
106
108
 
@@ -202,6 +204,10 @@ const diff = _.changes(
202
204
  updated,
203
205
  ['name', 'email', 'profile.bio']
204
206
  )
207
+
208
+ // 无需 try-catch 的错误处理
209
+ const result = _.swallow(() => riskyOperation()) // 出错时为 undefined
210
+ const items = _.swallowMap([1, 2, 3], item => processItem(item), true) // 过滤错误
205
211
  ```
206
212
 
207
213
  ### 使用插件
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ansuko",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "A modern JavaScript/TypeScript utility library that extends lodash with practical, intuitive behaviors. Fixes lodash quirks, adds Promise support, Japanese text processing, and GeoJSON utilities.",
5
5
  "keywords": [
6
6
  "lodash",