Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bassist/utils

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bassist/utils - npm Package Compare versions

Comparing version 0.15.0 to 0.16.0

dist/index.min.js

208

dist/index.d.ts

@@ -164,3 +164,3 @@ /**

/**
* Checks if the user's preferred color scheme is light
* Check whether the current screen is in portrait mode
*

@@ -176,2 +176,7 @@ * @category appearance

declare const landscapeMediaQuery: MediaQueryList | undefined;
/**
* Check whether the current screen is in landscape mode
*
* @category appearance
*/
declare function isLandscape(): boolean;

@@ -184,3 +189,3 @@

*/
type DataType = 'boolean' | 'string' | 'number' | 'bigint' | 'symbol' | 'null' | 'undefined' | 'function' | 'object' | 'array' | 'date' | 'error' | 'set' | 'map' | 'weakset' | 'weakmap' | 'file' | 'blob' | 'arraybuffer' | 'regexp';
type DataType = 'Array' | 'ArrayBuffer' | 'AsyncFunction' | 'BigInt' | 'Blob' | 'Boolean' | 'Date' | 'Error' | 'File' | 'Function' | 'Map' | 'Math' | 'Null' | 'Number' | 'Object' | 'Promise' | 'Set' | 'String' | 'Symbol' | 'RegExp' | 'Undefined' | 'WeakMap' | 'WeakSet';
/**

@@ -196,21 +201,21 @@ * Get the real data type

/**
* Determine whether the data is boolean
* Wrapper for `Array.isArray`, determine whether the data is Array
*
* @category data
*/
declare function isBoolean(value: unknown): value is boolean;
declare function isArray(value: unknown): value is any[];
/**
* Determine whether the data is string
* Determine whether the data is ArrayBuffer
*
* @category data
*/
declare function isString(value: unknown): value is string;
declare function isArrayBuffer(value: unknown): value is ArrayBuffer;
/**
* Determine whether the data is number
* Determine whether the data is AsyncFunction
*
* @category data
*/
declare function isNumber(value: unknown): value is number;
declare function isAsyncFunction(value: unknown): value is (...args: any) => Promise<any>;
/**
* Determine whether the data is bigint
* Determine whether the data is BigInt
*

@@ -221,96 +226,150 @@ * @category data

/**
* Determine whether the data is symbol
* Determine whether the data is Blob
*
* @category data
*/
declare function isSymbol(value: unknown): value is symbol;
declare function isBlob(value: unknown): value is Blob;
/**
* Determine whether the data is null
* Determine whether the data is Boolean
*
* @category data
*/
declare function isNull(value: unknown): value is null;
declare function isBoolean(value: unknown): value is boolean;
/**
* Determine whether the data is undefined
* Determine whether the data is Date
*
* @category data
*/
declare function isUndefined(value: unknown): value is undefined;
declare function isDate(value: unknown): value is Date;
/**
* Determine whether the data is function
* Determine whether the data is Error
*
* @category data
*/
declare function isError(value: unknown): value is Error;
/**
* Determine whether the data is Even
*
* @category data
*/
declare function isEven(value: unknown): value is number;
/**
* Determine whether the data is File
*
* @category data
*/
declare function isFile(value: unknown): value is File;
/**
* Wrapper for `Number.isFinite`, determine whether the data is finite
* @category data
*/
declare function isFinite(value: unknown): value is number;
/**
* Determine whether the data is Function
*
* @category data
*/
declare function isFunction(value: unknown): value is (...args: any) => any;
/**
* Determine whether the data is object
* Wrapper for `Number.isInteger`, determine whether the data is Integer
* @category data
*/
declare function isInteger(value: unknown): value is number;
/**
* Determine whether the data is Map
*
* @category data
*/
declare function isObject(value: unknown): value is Record<any, any>;
declare function isMap(value: unknown): value is Map<any, any>;
/**
* Determine whether the data is array
* Determine whether the data is Math
*
* @category data
*/
declare function isArray(value: unknown): value is any[];
declare function isMath(value: unknown): value is Math;
/**
* Determine whether the data is date
* Wrapper for `Number.isNaN`, determine whether the data is NaN
* @category data
*/
declare function isNaN(value: unknown): value is number;
/**
* Determine whether the data is Null
*
* @category data
*/
declare function isDate(value: unknown): value is Date;
declare function isNull(value: unknown): value is null;
/**
* Determine whether the data is error
* Determine whether the data is Number
*
* @category data
*/
declare function isError(value: unknown): value is Error;
declare function isNumber(value: unknown): value is number;
/**
* Determine whether the data is set
* Determine whether the data is Odd
*
* @category data
*/
declare function isSet(value: unknown): value is Set<any>;
declare function isOdd(value: unknown): value is number;
/**
* Determine whether the data is map
* Determine whether the data is Object
*
* @category data
*/
declare function isMap(value: unknown): value is Map<any, any>;
declare function isObject(value: unknown): value is Record<any, any>;
/**
* Determine whether the data is weakset
* Determine whether the data is Promise
*
* @category data
*/
declare function isWeakSet(value: unknown): value is WeakSet<WeakKey>;
declare function isPromise(value: unknown): value is Promise<any>;
/**
* Determine whether the data is weakmap
* Wrapper for `Number.isSafeInteger`, determine whether the data is Safe Integer
* @category data
*/
declare function isSafeInteger(value: unknown): value is number;
/**
* Determine whether the data is Promise
*
* @category data
*/
declare function isWeakMap(value: unknown): value is WeakMap<WeakKey, any>;
declare function isSet(value: unknown): value is Set<any>;
/**
* Determine whether the data is file
* Determine whether the data is String
*
* @category data
*/
declare function isFile(value: unknown): value is File;
declare function isString(value: unknown): value is string;
/**
* Determine whether the data is blob
* Determine whether the data is Symbol
*
* @category data
*/
declare function isBlob(value: unknown): value is Blob;
declare function isSymbol(value: unknown): value is symbol;
/**
* Determine whether the data is arraybuffer
* Determine whether the data is Undefined
*
* @category data
*/
declare function isArrayBuffer(value: unknown): value is ArrayBuffer;
declare function isUndefined(value: unknown): value is undefined;
/**
* Determine whether the data is regexp
* Determine whether the data is WeakMap
*
* @category data
*/
declare function isWeakMap(value: unknown): value is WeakMap<any, any>;
/**
* Determine whether the data is WeakSet
*
* @category data
*/
declare function isWeakSet(value: unknown): value is WeakSet<any>;
/**
* Determine whether the data is RegExp
*
* @category data
*/
declare function isRegExp(value: unknown): value is RegExp;

@@ -323,2 +382,3 @@ /**

declare function hasKey<T, K extends keyof T>(obj: T, key: K): key is K;
declare const hasOwnProperty: typeof hasKey;
/**

@@ -652,2 +712,36 @@ * String to byte stream

declare function formatDuration(timestamp: number, units?: FormatDurationUnit): string;
/**
* Remove HTML tags
*
* @param content HTML Codes
*
* @category format
*/
declare function removeHtmlTags(content: string): string;
/**
* Remove HTML tags and escape sequence
*
* @param content HTML Codes
*
* @category format
*/
declare function html2text(content: string): string;
/**
* Make sure the data you get is an array
*
* @category format
*/
declare function toArray<T>(value?: T | T[]): T[];
/**
* Ensure prefix of a string
*
* @category format
*/
declare function ensurePrefix(prefix: string, str: string): string;
/**
* Ensure suffix of a string
*
* @category format
*/
declare function ensureSuffix(suffix: string, str: string): string;

@@ -718,2 +812,14 @@ /**

/**
* Load a batch of images in concurrent mode
*
* @category network
*/
declare function concurrentLoadImages(images: string[]): Promise<unknown[]>;
/**
* Load a batch of images in serial mode
*
* @category network
*/
declare function serialLoadImages(images: string[]): Promise<void>;
/**
* Preload images

@@ -727,2 +833,6 @@ *

*
* @param mode - concurrent mode is used by default.
* If there are too many pictures,
* you can choose serial mode.
*
* @example

@@ -749,3 +859,3 @@ *

*/
declare function preloadImages(images: string[]): Promise<unknown[]>;
declare function preloadImages(images: string[], mode?: 'concurrent' | 'serial'): Promise<void>;

@@ -860,5 +970,7 @@ /**

*
* @param device - Get a random UA on the specified device type
*
* @category random
*/
declare function randomUserAgent(): string;
declare function randomUserAgent(device?: 'desktop' | 'mobile'): string;

@@ -962,2 +1074,14 @@ /**

/**
* User agents of desktop device by mock
*
* @category network
*/
declare const desktopUserAgents: string[];
/**
* User agents of mobile device by mock
*
* @category network
*/
declare const mobileUserAgents: string[];
/**
* User agents by mock

@@ -969,2 +1093,2 @@ *

export { ClipboardInstance, type CopyableElement, type DataType, FileInfo, type InRangeOptions, type LoadResOptions, LocalStorage, type NoOperationFunction, type PrefersColorScheme, type PromisifyNoOperationFunction, type ResourcesSupportedWithLoadRes, type RuntimeEnv, SessionStorage, type WritableElement, appleDevicesRegExp, camelCase, capitalize, checkRuntimeEnv, clipboard, darkMediaQuery, debounce, ellipsis, escapeRegExp, excludeFields, extractNumber, extractQueryInfo, formatAmount, formatDuration, formatTime, getBytes, getDataType, getPrefersColorScheme, getQuery, getRuntimeEnv, getUserAgent, hasKey, inRange, isAndroid, isAppleDevice, isArray, isArrayBuffer, isBaidu, isBankCard, isBigInt, isBlob, isBoolean, isBrowser, isDark, isDate, isDesktop, isDevRuntime, isEmail, isError, isFile, isFunction, isIOS, isIPv4, isIPv6, isIdCard, isLandscape, isLight, isMap, isMob, isMobile, isNull, isNumber, isObject, isPortrait, isProdRuntime, isQQ, isQQBrowser, isQzone, isRegExp, isServer, isSet, isString, isSymbol, isTablet, isTestRuntime, isUndefined, isUniApp, isUrl, isWeakMap, isWeakSet, isWeibo, isWeixin, jsonp, kebabCase, landscapeMediaQuery, lightMediaQuery, loadRes, mobileDevicesRegExp, noop, parseQuery, pascalCase, pnoop, portraitMediaQuery, preloadImages, randomBoolean, randomNumber, randomString, randomUserAgent, runtimeEnv, shuffle, sleep, sortKeys, stringifyQuery, tabletDevicesRegExp, throttle, unique, userAgents, watchResize };
export { ClipboardInstance, type CopyableElement, type DataType, FileInfo, type InRangeOptions, type LoadResOptions, LocalStorage, type NoOperationFunction, type PrefersColorScheme, type PromisifyNoOperationFunction, type ResourcesSupportedWithLoadRes, type RuntimeEnv, SessionStorage, type WritableElement, appleDevicesRegExp, camelCase, capitalize, checkRuntimeEnv, clipboard, concurrentLoadImages, darkMediaQuery, debounce, desktopUserAgents, ellipsis, ensurePrefix, ensureSuffix, escapeRegExp, excludeFields, extractNumber, extractQueryInfo, formatAmount, formatDuration, formatTime, getBytes, getDataType, getPrefersColorScheme, getQuery, getRuntimeEnv, getUserAgent, hasKey, hasOwnProperty, html2text, inRange, isAndroid, isAppleDevice, isArray, isArrayBuffer, isAsyncFunction, isBaidu, isBankCard, isBigInt, isBlob, isBoolean, isBrowser, isDark, isDate, isDesktop, isDevRuntime, isEmail, isError, isEven, isFile, isFinite, isFunction, isIOS, isIPv4, isIPv6, isIdCard, isInteger, isLandscape, isLight, isMap, isMath, isMob, isMobile, isNaN, isNull, isNumber, isObject, isOdd, isPortrait, isProdRuntime, isPromise, isQQ, isQQBrowser, isQzone, isRegExp, isSafeInteger, isServer, isSet, isString, isSymbol, isTablet, isTestRuntime, isUndefined, isUniApp, isUrl, isWeakMap, isWeakSet, isWeibo, isWeixin, jsonp, kebabCase, landscapeMediaQuery, lightMediaQuery, loadRes, mobileDevicesRegExp, mobileUserAgents, noop, parseQuery, pascalCase, pnoop, portraitMediaQuery, preloadImages, randomBoolean, randomNumber, randomString, randomUserAgent, removeHtmlTags, runtimeEnv, serialLoadImages, shuffle, sleep, sortKeys, stringifyQuery, tabletDevicesRegExp, throttle, toArray, unique, userAgents, watchResize };
{
"name": "@bassist/utils",
"version": "0.15.0",
"version": "0.16.0",
"description": "Opinionated collection of common JavaScript / TypeScript utils by @chengpeiquan .",

@@ -5,0 +5,0 @@ "author": "chengpeiquan <chengpeiquan@chengpeiquan.com>",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc