Skip to content

1.5.0

Compare
Choose a tag to compare
@pardnchiu pardnchiu released this 23 Sep 08:55

Overview

This release introduces several new features and improvements across various modules, including global functions, string operations, number utilities, array manipulations, object handling, map operations, image processing, and element manipulations. We've also marked some functions for deprecation in the upcoming 2.0.0 release to streamline our API.

Global

New Features

  • $random(target_length: number): Returns a random string of specified length (default 8). Replaces $key(target_length: number).

Deprecated (will be removed in 2.0.0)

  • $key: Use $random instead.

String

New Features

  • $regexp(flags: any, force_replace: any): Added force_replace parameter to forcibly convert symbols \^\$\{\}\|\,\[\]\(\)\=\!\*\+\.\?. Default is false.

Number

New Features

  • $random: Returns a random string of specified length.
  • $ASCII: Returns the specified ASCII character.

Array

New Features

  • $sum: Calculates the sum of all numeric elements in an array.
  • $shuffle: Returns a new array with randomly shuffled elements. Replaces $random.

Deprecated (will be removed in 2.0.0)

  • $random: Use $shuffle instead.

Object

New Features

  • $values: Returns all values of an object. Replaces $vals.
  • _: (target_key: string | number, target_value: any, replace_value?: boolean): Sets or updates the value of a specified key in an object. By default, it replaces existing values.

Deprecated (will be removed in 2.0.0)

  • $vals: Use $values instead.

Map

New Features

  • $values: Returns all values of a Map. Replaces $vals.

Deprecated (will be removed in 2.0.0)

  • $vals: Use $values instead.

Image

New Features

  • copy(): Copies the image to the clipboard.

Element

New Features

  • $$class(class_value: string | string[]): Added support for String[] to check multiple class types.
  • $$class_(check_bool?: any, class_value?: any): Modified to add or remove classes based on class_value if check_bool is not provided.
  • New shorthand methods for padding and margin:
    • _paddingT, _paddingL, _paddingB, _paddingR
    • _marginT, _marginL, _marginB, _marginR

Deprecated (will be removed in 2.0.0)

  • $$_class: Use $$class_ with inverted logic instead.
  • Full-name padding and margin methods (e.g., _paddingTop): Use shorthand versions instead.

概述

本次更新引入了多項新功能和改進,涵蓋全局函數、字串操作、數字工具、陣列操作、物件處理、映射操作、圖像處理和元素操作等多個模組。我們還標記了一些將在即將發布的 2.0.0 版本中棄用的函數,以簡化我們的 API。

全局

新功能

  • $random(target_length: number): 返回指定長度的隨機字串,預設長度為 8。取代 $key(target_length: number)

即將棄用(將在 2.0.0 版本中移除)

  • $key: 請改用 $random

字串

新功能

  • $regexp(flags: any, force_replace: any): 增加 force_replace 參數,用於強制轉換符號 \^\$\{\}\|\,\[\]\(\)\=\!\*\+\.\?。預設為 false

數字

新功能

  • $random: 返回指定長度的隨機字串。
  • $ASCII: 返回指定的 ASCII 字符。

陣列

新功能

  • $sum: 計算陣列中所有數值元素的總和。
  • $shuffle: 返回隨機打亂元素順序後的新陣列。取代 $random

即將棄用(將在 2.0.0 版本中移除)

  • $random: 請改用 $shuffle

物件

新功能

  • $values: 返回物件的所有值。取代 $vals
  • _: (target_key: string | number, target_value: any, replace_value?: boolean): 設置或更新物件指定鍵的值,預設會替換已存在的值。

即將棄用(將在 2.0.0 版本中移除)

  • $vals: 請改用 $values

映射(Map)

新功能

  • $values: 返回映射的所有值。取代 $vals

即將棄用(將在 2.0.0 版本中移除)

  • $vals: 請改用 $values

圖像

新功能

  • copy(): 將圖像複製到剪貼簿。

元素

新功能

  • $$class(class_value: string | string[]): 增加對 String[] 的支持,可檢查多個類型。
  • $$class_(check_bool?: any, class_value?: any): 修改為在未提供 check_bool 時,根據 class_value 來添加或移除類。
  • 新增 padding 和 margin 的簡寫方法:
    • _paddingT, _paddingL, _paddingB, _paddingR
    • _marginT, _marginL, _marginB, _marginR

即將棄用(將在 2.0.0 版本中移除)

  • $$_class: 請使用邏輯相反的 $$class_
  • 完整名稱的 padding 和 margin 方法(如 _paddingTop):請使用簡寫版本。