🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

todash

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

todash - npm Package Compare versions

Comparing version
2.0.0
to
2.1.0
+42
-0
dist/index.d.ts
import * as Utils from './utils';
import * as Tuple from './tuple';
import * as TupleShim from './tuple-shim';
import * as StringUtils from './string';
export * from './utils';
export * from './tuple';
export * from './string';
/**

@@ -58,2 +60,6 @@ * TypeScript 类型辅助工具

/**
* 确保指定类型一定是 string
*/
type EnsureString<T> = Utils.EnsureString<T>;
/**
* 返回元组的第一项

@@ -91,2 +97,38 @@ */

/**
* 将一个字符串元组的所有元素用指定分隔符连接成一个字符串并返回这个字符串
*/
type TupleJoin<StrArr extends string[], Separator extends string = ","> = Tuple.TupleJoin<StrArr, Separator>;
/**
* 用来判断当前字符串是否以另外一个给定的子字符串开头
*/
type StringStartsWith<Str extends string, SearchString extends string> = StringUtils.StringStartsWith<Str, SearchString>;
/**
* 用来判断当前字符串是否是以另外一个给定的子字符串“结尾”的
*/
type StringEndsWith<Str extends string, SearchString extends string> = StringUtils.StringEndsWith<Str, SearchString>;
/**
* 方法从字符串的开头删除空格
*/
type StringTrimStart<T extends string> = StringUtils.StringTrimStart<T>;
/**
* 从一个字符串的末端移除空白字符
*/
type StringTrimEnd<T extends string> = StringUtils.StringTrimEnd<T>;
/**
* 从一个字符串的两端删除空白字符
*/
type StringTrim<T extends string> = StringUtils.StringTrim<T>;
/**
* 构造并返回一个新字符串,该字符串包含被连接在一起的指定数量的字符串的副本
*/
type StringRepeat<Str extends string, Count extends number = 0> = StringUtils.StringRepeat<Str, Count>;
/**
* 将一个或多个字符串与原字符串连接合并,形成一个新的字符串并返回
*/
type StringConcat<Str extends string, StrOrStrArrForConcat extends string | string[] = ""> = StringUtils.StringConcat<Str, StrOrStrArrForConcat>;
/**
* 使用指定的分隔符字符串将一个字符串分割成子字符串元组,以一个指定的分割字串来决定每个拆分的位置
*/
type StringSplit<Str extends string, Separator extends string = ""> = StringUtils.StringSplit<Str, Separator>;
/**
* 返回元组的第一项

@@ -93,0 +135,0 @@ */

+0
-1

@@ -12,3 +12,2 @@ /**

* 删除元组的第一项,并返回被删除后的元组
*
*/

@@ -15,0 +14,0 @@ export declare type TupleByShift<T extends any[]> = ((...params: T) => any) extends ((param1: any, ...rest: infer P) => any) ? P : never;

@@ -1,2 +0,2 @@

import { UnionByPop, PopUnion } from './utils';
import { UnionByPop, PopUnion, EnsureString } from './utils';
/**

@@ -9,3 +9,3 @@ * 返回元组的第一项

*/
export declare type TupleByShift<T extends any[]> = T extends [any, ...infer Rest] ? Rest : never;
export declare type TupleByShift<T extends any[]> = T extends [any, ...infer Rest] ? Rest : [];
/**

@@ -22,3 +22,3 @@ * 将一个类型添加元组的开头,并返回元组

*/
export declare type TupleByPop<T extends any[]> = T extends [...infer Head, any] ? Head : never;
export declare type TupleByPop<T extends any[]> = T extends [...infer Head, any] ? Head : [];
/**

@@ -41,2 +41,10 @@ * 将一个类型添加元组的末尾,并返回元组

/**
*【递归地】将一个元组的所有元素连接成一个字符串并返回这个字符串
*/
declare type _JoinRecursion<Acc extends string, Separator extends string, AccArr extends string[]> = AccArr['length'] extends 0 ? Acc : _JoinRecursion<`${Acc}${AccArr['length'] extends 0 ? '' : Separator}${EnsureString<ShiftTuple<AccArr>>}`, Separator, TupleByShift<AccArr>>;
/**
* 将一个字符串元组的所有元素用指定分隔符连接成一个字符串并返回这个字符串
*/
export declare type TupleJoin<StrArr extends string[], Separator extends string = ','> = _JoinRecursion<EnsureString<ShiftTuple<StrArr>>, Separator, TupleByShift<StrArr>>;
/**
* 【递归地】 将 union 转化为 元组

@@ -43,0 +51,0 @@ * */

@@ -63,1 +63,5 @@ /**

export declare type EnsureArray<T> = T extends any[] ? T : [];
/**
* 确保指定类型一定是 string
*/
export declare type EnsureString<T> = T extends string ? T : '';
{
"name": "todash",
"version": "2.0.0",
"version": "2.1.0",
"description": "Todash 是一个类型推导工具库,旨在帮助你快速方便的编写具备类型推导的 TypeScript 代码。",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -9,2 +9,3 @@ <h1 align="center">Todash</h1>

+ 【持续增加...】丰富的 **元组(Tuple)** 操作符,方便操作
+ 【持续增加...】丰富的 **字符串(String)** 操作符,方便操作

@@ -15,3 +16,3 @@ ## 文档

文件分为几个部分:
文档分为几个部分:

@@ -18,0 +19,0 @@ + 使用说明