1.4.0
Overview
This release introduces several new features and improvements across various modules, including Array, FormData, Map, Element, URL, and Date. To ensure a smooth transition for future releases, some functions are marked for deprecation. Additionally, bugs related to URL query handling and date formatting have been fixed.
String
New Features
- Function
copy()
replaces$copy()
;
Will Deprecate (2.*.*
)
- Function
$copy()
;
Number
New Features
- Function
$gone
returns a relative time description in Chinese or English based on the language setting;
Array
New Features
- Function
_(value: any | any[], index?: number)
enhanced:- Adds an optional
index
parameter to specify the insertion position; - Supports inserting an element or array at a specific index;
- If
index
is not provided, the default behavior of adding elements to the end of the array remains;
- Adds an optional
Resolved Issues
- Function
$_(index: number)
now correctly removes the element at the specified index and returns the updated array;
Object
New Features
- Function
forEach(value?: (key: string, val: any) => void)
replaces$forEach(value?: (key: string, val: any) => void)
;
Will Deprecate (2.*.*
)
- Function
$forEach(value?: (key: string, val: any) => void)
;
Map
New Features
- Function
$json
replaces$obj
; - Function
$_(key?: any)
removes the element with the specified key and returns the updatedMap
; - Function
$$(value: any)
checks if theMap
contains the specified value;
Will Deprecate (2.*.*
)
- Function
$obj
;
FormData
New Features
- Function
$map
returns aMap<string, any>
; - Function
$json
returns an object{ [key: string]: any }
;
Date
New Features
- Function
$S
returns centiseconds; - Function
$SS
returns deciseconds; - Function
$SSS
returns milliseconds; - Function
$dddd
returns the full name of the day (e.g., 'Sunday'); - Function
$ddd
returns the abbreviated day name (e.g., 'Sun'); - Function
$format
now supports the formats 'S', 'SS', 'SSS', 'ddd', 'dddd';
Resolved Issues
- Function
$dd
now correctly returns a two-letter abbreviation (e.g., 'Su'); - Function
$y
now returns a format consistent with$yy
;
URL
Resolved Issues
- Function
$queryAll
now correctly processes query parameters;
Element
New Features
-
Function
_padding(top?: number | string, right?: number | string, bottom?: number | string, left?: number | string)
replaces_p(top?: number | string, right?: number | string, bottom?: number | string, left?: number | string)
; -
Function
_paddingTop(value?: number | string)
replaces_pt(value?: number | string)
; -
Function
_paddingLeft(value?: number | string)
replaces_pl(value?: number | string)
; -
Function
_paddingBottom(value?: number | string)
replaces_pb(value?: number | string)
; -
Function
_paddingRight(value?: number | string)
replaces_pr(value?: number | string)
; -
Function
_margin(top?: number | string, right?: number | string, bottom?: number | string, left?: number | string)
replaces_m(top?: number | string, right?: number | string, bottom?: number | string, left?: number | string)
; -
Function
_marginTop(value?: number | string)
replaces_mt(value?: number | string)
; -
Function
_marginLeft(value?: number | string)
replaces_ml(value?: number | string)
; -
Function
_marginBottom(value?: number | string)
replaces_mb(value?: number | string)
; -
Function
_marginRight(value?: number | string)
replaces_mr(value?: number | string)
; -
Function
$formData
- Returns
FormData
for<form>
elements; - Returns
undefined
for non-<form>
elements;
- Returns
-
Function
$map
- Processes
$formData
results; - Returns a
Map<string, any>
orundefined
;
- Processes
-
Function
$json
- Processes
$formData
results; - Returns an object
{ [key: string]: any }
orundefined
;
- Processes
Will Deprecate (2.*.*
)
- Function
_p(top?: number | string, right?: number | string, bottom?: number | string, left?: number | string)
; - Function
_pt(value?: number | string)
; - Function
_pl(value?: number | string)
; - Function
_pb(value?: number | string)
; - Function
_pr(value?: number | string)
; - Function
_m(top?: number | string, right?: number | string, bottom?: number | string, left?: number | string)
; - Function
_mt(value?: number | string)
; - Function
_ml(value?: number | string)
; - Function
_mb(value?: number | string)
; - Function
_mr(value?: number | string)
;
概述
此版本引入了多個模組的新功能和改進,包括 Array、FormData、Map、Element、URL 和 Date。為了確保未來版本的順利過渡,一些函數被標記為即將棄用。此外,還修復了 URL 查詢處理和日期格式化方面的錯誤。
String
新功能
- 函數
copy()
取代$copy()
;
即將棄用 (2.*.*
)
- 函數
$copy()
;
Number
新功能
- 函數
$gone
根據語言設定,返回相對時間的中文或英文描述;
Array
新功能
- 函數
_(value: any | any[], index?: number)
增強功能:- 新增可選參數
index
,用於指定插入位置; - 支援在指定索引處插入元素或數組;
- 當不提供
index
時,保持在數組末尾添加元素的行為;
- 新增可選參數
修正問題
- 函數
$_(index: number)
現在可以正確移除指定索引的元素並返回更新後的數組;
Object
新功能
- 函數
forEach(value?: (key: string, val: any) => void)
取代$forEach(value?: (key: string, val: any) => void)
;
即將棄用 (2.*.*
)
- 函數
$forEach(value?: (key: string, val: any) => void)
;
Map
新功能
- 函數
$json
取代$obj
; - 函數
$_(key?: any)
刪除指定鍵並返回更新的Map
; - 函數
$$(value: any)
檢查Map
是否包含指定值;
即將棄用 (2.*.*
)
- 函數
$obj
;
FormData
新功能
- 函數
$map
返回Map<string, any>
; - 函數
$json
返回物件{ [key: string]: any }
;
Date
新功能
- 函數
$S
返回百毫秒; - 函數
$SS
返回十毫秒; - 函數
$SSS
返回毫秒; - 函數
$dddd
返回完整星期名稱 (如 'Sunday'); - 函數
$ddd
返回星期縮寫 (如 'Sun'); - 函數
$format
現支援 'S'、'SS'、'SSS'、'ddd'、'dddd' 格式;
修正問題
- 函數
$dd
現正確返回兩字母縮寫 (如 'Su'); - 函數
$y
現返回與$yy
一致的格式;
URL
修正問題
- 函數
$queryAll
現正確處理查詢參數;
Element
新功能
-
函數
_padding(top?: number | string, right?: number | string, bottom?: number | string, left?: number | string)
取代_p(top?: number | string, right?: number | string, bottom?: number | string, left?: number | string)
; -
函數
_paddingTop(value?: number | string)
取代_pt(value?: number | string)
; -
函數
_paddingLeft(value?: number | string)
取代_pl(value?: number | string)
; -
函數
_paddingBottom(value?: number | string)
取代_pb(value?: number | string)
; -
函數
_paddingRight(value?: number | string)
取代_pr(value?: number | string)
; -
函數
_margin(top?: number | string, right?: number | string, bottom?: number | string, left?: number | string)
取代_m(top?: number | string, right?: number | string, bottom?: number | string, left?: number | string)
; -
函數
_marginTop(value?: number | string)
取代_mt(value?: number | string)
; -
函數
_marginLeft(value?: number | string)
取代_ml(value?: number | string)
; -
函數
_marginBottom(value?: number | string)
取代_mb(value?: number | string)
; -
函數
_marginRight(value?: number | string)
取代_mr(value?: number | string)
; -
函數
$formData
- 對
<form>
元素返回FormData
; - 非
<form>
元素返回undefined
;
- 對
-
函數
$map
- 處理
$formData
結果; - 返回
Map<string, any>
或undefined
;
- 處理
-
函數
$json
- 處理
$formData
結果; - 返回物件
{ [key: string]: any }
或undefined
;
- 處理
即將棄用 (2.*.*
)
- 函數
_p(top?: number | string, right?: number | string, bottom?: number | string, left?: number | string)
; - 函數
_pt(value?: number | string)
; - 函數
_pl(value?: number | string)
; - 函數
_pb(value?: number | string)
; - 函數
_pr(value?: number | string)
; - 函數
_m(top?: number | string, right?: number | string, bottom?: number | string, left?: number | string)
; - 函數
_mt(value?: number | string)
; - 函數
_ml(value?: number | string)
; - 函數
_mb(value?: number | string)
; - 函數
_mr(value?: number | string)
;