/** * 基础工具库。基于 {@link https://lodash.com/docs/4.17.15 | Lodash}。 * * @packageDocumentation */ /// import { Config } from 'decimal.js-light'; import DecimalLight from 'decimal.js-light'; import type { IsLowerCase } from './internal'; import type { IsNumeric } from './internal'; import type { IsUpperCase } from './internal'; import { Numeric } from 'decimal.js-light'; import type { ParseSelector } from 'typed-query-selector/parser'; import type { TruncateOptions } from 'lodash'; import type { UpperCaseCharacters } from './internal'; import type { WordSeparators } from './internal'; declare type AllValues> = { [P in keyof T]: { label: P; value: T[P] extends true ? 'true' : T[P] extends false ? 'false' : T[P]; }; }[keyof T]; /** * 任意异步函数。 * * @public */ declare type AnyAsyncFunction = Record & { (...args: any[]): Promise; }; /** * 任意函数。 * * @public */ declare type AnyFunction_2 = Record & { (...args: any[]): any; }; /** * 任意对象。 * * @public */ declare type AnyObject_2 = Record; /** * 将给定的值 `RequiredDeep` 化。 * * @param value 值 */ export declare function asRequiredDeep(value: T): RequiredDeep; /** * 异步函数并行执行限制。 * * @param asyncFn 异步函数 * @param options 选项 */ export declare function asyncLimit Promise>(asyncFn: T, options?: AsyncLimitOptions): T; export declare interface AsyncLimitOptions Promise> { /** * 并行量。 * * @default 1 */ concurrency?: number; /** * 按参数分组,分组之间并行执行,组内按顺序执行。 * * @default 不分组 */ groupBy?: (...args: Parameters) => string; } /** * 异步函数执行缓存。 * * @param asyncFn 异步函数 * @param options 选项 */ export declare function asyncMemoize Promise>(asyncFn: T, options?: AsyncMemoizeOptions): T & { cache: AsyncMemoizeCacheMap; }; export declare type AsyncMemoizeCacheMap = Map; export declare interface AsyncMemoizeOptions Promise> { /** * 缓存键。 * * @default arg0 => arg0 */ cacheKey?: (...args: Parameters) => any; /** * 缓存时效(毫秒)。 * * - `0` 表示永久缓存,直到手动清除或发生错误。 * - `while-pending` 或 `-1` 表示仅在异步操作未完成前缓存,完成后失效。 * - `数字` 表示具体的缓存时长(毫秒)。 * - `函数形式` 可根据结果和参数动态设置时效。 * * @default 0 */ cacheTTL?: 'while-pending' | number | ((result: Awaited>, ...args: Parameters) => number | void); } /** Useful as a return type in interfaces or abstract classes with missing implementation */ declare type AsyncOrSync = PromiseLike | T; /** * 将给定的 base64 字符串解码为 UTF8 字符串。 * * @public * @param value 要解码的 base64 字符串 * @returns 返回解码后的 UTF8 字符串 * @example * ```typescript * base64Decode('dg==') // => 'v' * base64Decode('6b6Z') // => '龙' * base64Decode('8J+QsQ==') // => '🐱' * ``` */ export declare function base64Decode(value: string): string; /** * base64.js * Dan Kogai (https://github.com/dankogai) * Licensed under the BSD 3-Clause License * https://github.com/dankogai/js-base64/blob/master/LICENSE.md * * Modified by Jay Fong */ /** * 将给定的 UTF8 字符串编码为 base64 字符串。 * * @public * @param value 要编码的 UTF8 字符串 * @returns 返回编码后的 base64 字符串 * @example * ```typescript * base64Encode('v') // => 'dg==' * base64Encode('龙') // => '6b6Z' * base64Encode('🐱') // => '8J+QsQ==' * ``` */ export declare function base64Encode(value: string): string; /** * 将给定的 base64url 字符串解码为 UTF8 字符串。 * * @public * @param value 要解码的 base64url 字符串 * @returns 返回解码后的 UTF8 字符串 * @example * ```typescript * base64UrlDecode('dg') // => 'v' * base64UrlDecode('6b6Z') // => '龙' * base64UrlDecode('8J-QsQ') // => '🐱' * ``` */ export declare function base64UrlDecode(value: string): string; /** * 将给定的 UTF8 字符串编码为 URL 安全的 base64url 字符串。 * * @public * @param value 要编码的 UTF8 字符串 * @returns 返回编码后的 base64url 字符串 * @example * ```typescript * base64UrlEncode('v') // => 'dg' * base64UrlEncode('龙') // => '6b6Z' * base64UrlEncode('🐱') // => '8J-QsQ' * ``` */ export declare function base64UrlEncode(value: string): string; declare type BaseElements = ParentNode | Iterable; /** * 绑定事件。 * * @public * @param target 事件绑定的目标 * @returns 返回事件绑定函数 * @example * ```typescript * const bindWindowEvent = bindEvent(window) * const unbindClick = bindWindowEvent('click', console.log) * const unbindScroll = bindWindowEvent('scroll', console.log) * ``` */ export declare function bindEvent>(target: T): BindEventFunction; /** * 绑定事件函数。 * * @public * @param type 事件类型 * @param callback 事件回调 * @param options 事件选项 * @returns 返回事件解绑函数 */ export declare type BindEventFunction = , K extends keyof E>(type: K, callback: (this: T, ev: E[K]) => any, options?: boolean | AddEventListenerOptions) => () => any; declare const brands: readonly ["微信", "QQ", "支付宝", "京东", "百度", "字节跳动", "钉钉"]; declare type Builtin = Primitive_2 | Function | Date | Error | RegExp; /** * 获取字节值。 * * @param value 值 * @param unit 单位 */ export declare function bytes(value: number, unit: BytesUnit): number; /** * 获取字节值。 * * @param value 值 */ export declare function bytes(value: BytesValue): number; export declare type BytesNumberValue = number; export declare type BytesStringValue = `${number}${BytesUnit}`; export declare type BytesUnit = 'PB' | 'TB' | 'GB' | 'MB' | 'KB' | 'B'; export declare type BytesValue = BytesNumberValue | BytesStringValue; /** * 科学计算器。主要是为了避免 js 的浮点数精度计算问题。 */ export declare const Calculator: CalculatorInstance; export declare interface CalculatorConfig extends Config { /** 小数位数 */ decimalPlaces?: number; } export declare type CalculatorFunctionValue = (calculator: CalculatorInstance) => OneOrMore; export declare interface CalculatorInstance { /** * decimal.js 引用。 */ decimal: typeof DecimalLight; /** * 根据配置创建一个新的计算器。 * * @param config 配置 */ make(config?: CalculatorConfig): CalculatorInstance; /** * 加。 * * - 加数列表为空时返回 0; * - 加数列表长度为 1 时返回第 1 个的值。 * * @param values 加数列表 */ add(...values: CalculatorValue[]): T; /** * 减。 * * - 减数列表为空时返回 0; * - 减数列表长度为 1 时返回第 1 个的值。 * * @param values 减数列表 */ sub(...values: CalculatorValue[]): T; /** * 乘。 * * - 乘数列表为空时返回 0; * - 乘数列表长度为 1 时返回第 1 个的值。 * * @param values 乘数列表 */ mul(...values: CalculatorValue[]): T; /** * 除。 * * - 除数列表为空时返回 0; * - 除数列表长度为 1 时返回第 1 个的值。 * * @param values 除数列表 */ div(...values: CalculatorValue[]): T; /** * 转换为数字。 * * @param value 值 */ toNumber(value: CalculatorPrimitiveValue): T; } export declare type CalculatorPrimitiveValue = Numeric; export declare type CalculatorValue = CalculatorPrimitiveValue | CalculatorFunctionValue; /** Convert a string literal to camel-case. This can be useful when, for example, converting some kebab-cased command-line flags or a snake-cased database result. By default, consecutive uppercase letter are preserved. See {@link CamelCaseOptions.preserveConsecutiveUppercase preserveConsecutiveUppercase} option to change this behaviour. @example ``` import type {CamelCase} from 'type-fest'; // Simple const someVariable: CamelCase<'foo-bar'> = 'fooBar'; // Advanced type CamelCasedProperties = { [K in keyof T as CamelCase]: T[K] }; interface RawOptions { 'dry-run': boolean; 'full_family_name': string; foo: number; BAR: string; QUZ_QUX: number; 'OTHER-FIELD': boolean; } const dbResult: CamelCasedProperties = { dryRun: true, fullFamilyName: 'bar.js', foo: 123, bar: 'foo', quzQux: 6, otherField: false }; ``` @category Change case @category Template literal */ declare type CamelCase = Type extends string ? string extends Type ? Type : Uncapitalize ? Lowercase : Type>, Options>> : Type; /** Convert an array of words to camel-case. */ declare type CamelCaseFromArray< Words extends string[], Options extends CamelCaseOptions, OutputString extends string = '', > = Words extends [ infer FirstWord extends string, ...infer RemainingWords extends string[], ] ? Options['preserveConsecutiveUppercase'] extends true ? `${Capitalize}${CamelCaseFromArray}` : `${Capitalize>}${CamelCaseFromArray}` : OutputString; /** CamelCase options. @see {@link CamelCase} */ declare type CamelCaseOptions = { /** Whether to preserved consecutive uppercase letter. @default true */ preserveConsecutiveUppercase?: boolean; }; /** * 计算多个数组的笛卡尔积。 * * @param arr 数组内容 * @example * ```typescript * cartesianProduct([ * ['a', 'b'], * [1, 2], * ]) * // => [['a', 1], ['a', 2], ['b', 1], ['b', 2]] * ``` */ export declare function cartesianProduct(arr: [T[]]): [T][]; export declare function cartesianProduct(arr: [T[], U[]]): [T, U][]; export declare function cartesianProduct(arr: [T[], U[], V[]]): [T, U, V][]; export declare function cartesianProduct(arr: [T[], U[], V[], W[]]): [T, U, V, W][]; export declare function cartesianProduct(arr: [T[], U[], V[], W[], X[]]): [T, U, V, W, X][]; export declare function cartesianProduct(arr: [T[], U[], V[], W[], X[], Y[]]): [T, U, V, W, X, Y][]; export declare function cartesianProduct(arr: [T[], U[], V[], W[], X[], Y[], Z[]]): [T, U, V, W, X, Y, Z][]; export declare function cartesianProduct(arr: any[][]): any[][]; /** * UTF8 字符转为 Unicode 码点。 * * @param character 字符,支持多个字符,返回的码点将以 `-` 分割 */ export declare function characterToCodepoint(character: string): string; /** * 选择文件。 * * @param accept 接受的文件类型,其中默认的 `image` 表示 `image/*` * @param multiple 是否多选 * @returns 返回选中的文件列表 */ export declare function chooseFile(accept: LiteralUnion<'image', string>, multiple?: boolean): Promise>; /** * 选择文件。 * * @param accept 接受的文件类型,其中默认的 `image` 表示 `image/*` * @param options 选项 * @returns 返回选中的文件列表 */ export declare function chooseFile(accept: LiteralUnion<'image', string>, options?: ChooseFileOptions): Promise>; export declare interface ChooseFileOptions { /** * 是否多选 * * @default false */ multiple?: boolean; /** * 元素准备好后的回调 */ afterElementReady?: (payload: { el: HTMLInputElement; }) => any; } /** * 类似 `chunk`,但当每组条目数量不一致时会在最后一组添加填充值以达到每组条目数量一致。 * * @param array 数组 * @param size 分组大小 * @param filler 填充值 * @param consistent 是否保持一致性,默认 false,设为 true 则当数组长度小于分组大小时也填充数组使其长度达到分组大小 */ export declare function chunkEqual(array: T[], size: number, filler: (index: number) => T, consistent?: boolean): T[][]; /** * 深克隆快速版。 * * @param value 要克隆的值 * @param ignore 忽略的值 * @returns 返回克隆后的值 * @example * ```typescript * cloneDeepFast({ x: [1] }) * // => { x: [1] } * ``` */ export declare function cloneDeepFast(value: T, ignore?: (value: unknown) => boolean | undefined): T; /** * Unicode 码点转为 UTF8 字符。 * * @param codepoint 码点,支持以 `-` 分割多个码点 */ export declare function codepointToCharacter(codepoint: string): string; export declare type ConditionalArrayItem = (IsNever extends true ? T : Merge>; }>) | false; /** Convert a string literal to screaming-snake-case. This can be useful when, for example, converting a camel-cased object property to a screaming-snake-cased SQL column name. @example ``` import type {ScreamingSnakeCase} from 'type-fest'; const someVariable: ScreamingSnakeCase<'fooBar'> = 'FOO_BAR'; ``` @category Change case @category Template literal */ declare type ConstantCase = Value extends string ? IsScreamingSnakeCase extends true ? Value : Uppercase> : Value; /** * 转换文本为大写字符串,单词之间带有下划线。 * * @param text 要转换的文本 * @returns 返回结果 * @example * ```typescript * constantCase('test string') * // => TEST_STRING * ``` */ export declare function constantCase(text: T): ConstantCase; /** * 复制文本到剪切板。 * * @param text 要复制的文本 * @param options 选项 * @returns 返回是否复制成功 */ export declare function copyTextToClipboard(text: string, options?: CopyTextToClipboardOptions): boolean; export declare interface CopyTextToClipboardOptions { /** * 复制容器的类名。 */ containerClass?: string; } /** * 创建提交类行为。 * * @param options 选项 */ export declare function createSubmit(options: CreateSubmitOptions): CreateSubmitResult; /** * 创建提交类行为。 * * @param options 选项 */ export declare function createSubmit(options: CreateSubmitOptions): CreateSubmitResult; export declare interface CreateSubmitOptions { /** * 开始回调。 * * @param message 提示信息 */ start(message: T | undefined, id: number): AsyncOrSync; /** * 失败回调。 * * @param message 提示信息 * @param duration 持续时间(毫秒) */ fail(message: T, duration: number, id: number): AsyncOrSync; /** * 成功回调。 * * @param message 提示信息 * @param duration 持续时间(毫秒) */ success(message: T, duration: number, id: number): AsyncOrSync; /** * 完成回调。 */ complete(id: number): AsyncOrSync; /** * 异常回调。 */ throw?(error: unknown, id: number): AsyncOrSync; } export declare type CreateSubmitResult = ((action: (payload: SubmitActionPayload) => Promise) => Promise) & Pick, 'fail' | 'success'>; /** * 创建 url 查询字符串。 * * @param parameters 查询参数 * @param options 选项 * @returns 返回 url 查询字符串 * @example * ```typescript * createUrlQueryString({ x: 1, y: 'z' }) // => x=1&y=z * ``` */ export declare function createUrlQueryString(parameters: AnyObject_2, options?: CreateUrlQueryStringOptions): string; export declare interface CreateUrlQueryStringOptions { /** * 键值内部的连接符。 */ pairSeparator?: string; /** * 各参数间的连接符。 */ partSeparator?: string; } /** * 数据打包器。 */ export declare class DataPacker { private static encodeIndexes; private static decodeIndexes; /** * 打包数据。 */ static pack(rawData: TRawObjectData): PackedData; /** * 返回结果同 `pack()`,不过类型是原数据的类型。 */ static packAsRawType(rawData: T): T; /** * 解包数据。 */ static unpack(packedData: PackedData): RawData; /** * 如果是打包后的数据,则解包后返回,否则直接返回。如果是对象,则递归尝试解包。 * * @param value 数据 * @param depth 递归层级,默认:2 * @returns 返回结果数据 */ static unpackIfNeeded(value: any, depth?: number): any; } /** * 移除每一行的公共前导空白。 * * @public * @param text 文本 * @returns 返回处理后的结果 * @example * ```typescript * dedent(' a\n b') // => 'a\nb' * ``` */ export declare function dedent(text: string): string; /** * 首先,每一行紧跟前导空白的插入值为多行时,保持缩进。 * 然后,移除每一行的公共前导空白。 * * @public * @param literals 字面值 * @param interpolations 插入值 * @returns 返回处理后的结果 * @example * ```typescript * dedent` a\n b` // => 'a\nb' * ``` */ export declare function dedent(literals: TemplateStringsArray, ...interpolations: Array): string; /** * 设置默认索引。当前索引为 `-1` 或 `NaN` 时会使用默认索引。 * * @param index 当前索引 * @param defaultIndex 默认索引 */ export declare function defaultIndexTo(index: number, defaultIndex: number): number; /** Convert a string literal to a custom string delimiter casing. This can be useful when, for example, converting a camel-cased object property to an oddly cased one. @see KebabCase @see SnakeCase @example ``` import type {DelimiterCase} from 'type-fest'; // Simple const someVariable: DelimiterCase<'fooBar', '#'> = 'foo#bar'; // Advanced type OddlyCasedProperties = { [K in keyof T as DelimiterCase]: T[K] }; interface SomeOptions { dryRun: boolean; includeFile: string; foo: number; } const rawCliOptions: OddlyCasedProperties = { 'dry#run': true, 'include#file': 'bar.js', foo: 123 }; ``` @category Change case @category Template literal */ declare type DelimiterCase = string extends Value ? Value : Value extends string ? StringArrayToDelimiterCase< SplitIncludingDelimiters, true, WordSeparators, UpperCaseCharacters, Delimiter > : Value; /** * 文本脱敏。 * * @param text 待脱敏的文本 * @param options 脱敏选项 */ export declare function desensitize(text: string, options?: DesensitizeOptions): string; export declare interface DesensitizeOptions { /** * 脱敏策略 */ strategy?: DesensitizeStrategy; /** * 脱敏替换字符 * * @default '*' */ replacer?: string; /** * 前置保留字符数 * * @default 0 */ preKeep?: number; /** * 后置保留字符数 * * @default 0 */ postKeep?: number; } export declare enum DesensitizeStrategy { CHINESE_NAME = "CHINESE_NAME", CHINESE_ID_CARD_NUMBER = "CHINESE_ID_CARD_NUMBER", CHINESE_MOBILE_PHONE_NUMBER = "CHINESE_MOBILE_PHONE_NUMBER", EMAIL = "EMAIL" } /** * 开发环境和生产环境返回不同的值或调用不同的函数。 * * `process.env.NODE_ENV` 为空值、`production`、`prod` 时被认为是生产环境,否则是开发环境。 * * @param devValue 开发环境返回的值或调用的函数 * @param prodValue 生产环境返回的值或调用的函数 */ export declare const devOrProd: { R = () => R>(devValue: T | F, prodValue: T | F): R; /** * 构造 devOrProd。 */ make: typeof makeDevOrProd; }; export declare type ElementOfRawData = TRawData extends RawData ? X : never; export declare type EnumKey = string; export declare type EnumMap = Record; export declare type EnumResult = T & InvertResult & { $list: List; $buildList: (keys: Array | Record) => List; $is(value: any, keys: OneOrMore>>): boolean; }; export declare type EnumValue = string | number | boolean; /** * 事件巴士,管理事件的发布与订阅。 * * @template TListeners 事件名称及其对应的回调描述 * @example * ```typescript * const bus = new EventBus<{ * success: (payload: { message: string }) => any * }>() * bus.on('success', ({ message }) => console.log(message)) * bus.emit('success', { message: '提交成功' }) * // => 控制台输出: 提交成功 * ``` */ export declare class EventBus { private options?; /** * 构造函数。 */ constructor(options?: EventBusOptions | undefined); /** * 回调列表。 */ private callbacks; /** * 订阅多个事件。 * * @param eventNames 事件名称 * @param callback 事件触发回调 * @returns 返回取消订阅的函数 */ on(eventNames: TListenerName[], callback: (firstPayload: { [K in TListenerName]: Parameters[0]; }, payload: { [K in TListenerName]: Parameters; }) => any): EventBusOffListener; /** * 订阅单个事件。 * * @param eventName 事件名称 * @param callback 事件触发回调 * @returns 返回取消订阅的函数 */ on(eventName: TListenerName, callback: TListeners[TListenerName]): EventBusOffListener; /** * 订阅事件,但只订阅一次即取消订阅。 * * @param eventName 事件名称 * @param callback 事件触发回调 * @returns 返回取消订阅的函数 */ once(eventName: TListenerName, callback: TListeners[TListenerName]): EventBusOffListener; /** * 取消订阅事件,若没有指定回调,则取消所有回调。 * * @param eventName 事件名称 * @param callback 事件触发回调 */ off(eventName: TListenerName, callbackOrTag?: TListeners[TListenerName] | string | number): void; /** * 发布事件。 * * @param eventNameAndContext 事件名称和上下文 * @param args 传给事件回调的参数 * @returns 返回各事件回调的返回结果组成的数组 */ emit(eventName: TListenerName | EventBusListenerDescriptor, ...args: Parameters): Array>; /** * 局部执行。 * * @param fn 执行函数 * @returns 可以返回一个或多个取消订阅的函数 */ run(fn: (bus: this) => void | EventBusOffListener | EventBusOffListener[]): EventBusOffListener; /** * 清空事件订阅。 */ clear(): void; /** * 销毁。 */ destroy(): void; } export declare type EventBusBeforeEmit = { [TListenerName in keyof TListeners]?: (this: EventBus, context: any) => any; }; export declare type EventBusBeforeOn = { [TListenerName in keyof TListeners]?: (this: EventBus, callback: EventBusListener) => TListeners[TListenerName]; }; export declare type EventBusListener any = (...args: any[]) => any> = TCallback & { __EVENT_BUS_TAG__?: EventBusListenerTag; }; export declare interface EventBusListenerDescriptor { name: TListenerName; context?: any; tag?: EventBusListenerTag; filter?: (callback: EventBusListener, index: number, callbacks: EventBusListener[]) => boolean; } export declare type EventBusListeners = Record; export declare type EventBusListenerTag = string | number; export declare type EventBusOffListener = () => any; export declare interface EventBusOptions { beforeOn?: EventBusBeforeOn; beforeEmit?: EventBusBeforeEmit; } /** * 格式化字节数,以 1024 作为千字节数。 * * @param value 要格式化的字节数 * @returns 返回结果 */ export declare function formatBytes(value: number): string; /** * 格式化数字。 * * @param value 要格式化的数字 * @param options 选项 * @returns 返回格式化后的数值 * @example * ```typescript * formatNumber(1314.56789) // => '1,314.56789' * formatNumber(1314.56789, { thousandsSeparator: ' ' }) // => '1 314.56789' * formatNumber(1314.56789, { thousandthsSeparator: ',' }) // => '1,314.567,89' * ``` */ export declare function formatNumber(value: number, options?: FormatNumberOptions): string; /** * 格式化数字选项。 */ export declare interface FormatNumberOptions { /** * 整数部分的千分位分隔符。 * * @default ',' */ thousandsSeparator?: string; /** * 小数部分的千分位分隔符。 * * @default '' */ thousandthsSeparator?: string; } /** * 地理坐标系转换工具。 * * - `大地坐标系(WGS84 坐标系)`: GPS 全球卫星定位系统使用的坐标系; * - `火星坐标系(GCJ02 坐标系)`: 腾讯地图、高德地图等使用的坐标系,是由中国国家测绘局制定的由 WGS84 加密后得到的坐标系; * - `百度坐标系(BD09 坐标系)`: 百度地图使用的坐标系,是在 GCJ02 基础上再次加密得到的坐标系。 */ export declare class GeoCoord { /** * `WGS84 坐标系` 转 `GCJ02 坐标系`。 * * 应用场景:GPS 坐标转腾讯地图、高德地图坐标。 */ static WGS84ToGCJ02: (input: GeoCoordTransformInput) => GeoCoordTransformOutput; /** * `WGS84 坐标系` 转 `BD09 坐标系`。 * * 应用场景:GPS 坐标转百度地图坐标。 */ static WGS84ToBD09: (input: GeoCoordTransformInput) => GeoCoordTransformOutput; /** * `GCJ02 坐标系` 转 `WGS84 坐标系`。 * * 应用场景:腾讯地图、高德地图坐标转 GPS 坐标。 */ static GCJ02ToWGS84: (input: GeoCoordTransformInput) => GeoCoordTransformOutput; /** * `GCJ02 坐标系` 转 `BD09 坐标系`。 * * 应用场景:腾讯地图、高德地图坐标转百度地图坐标。 */ static GCJ02ToBD09: (input: GeoCoordTransformInput) => GeoCoordTransformOutput; /** * `BD09 坐标系` 转 `WGS84 坐标系`。 * * 应用场景:百度地图坐标转 GPS 坐标。 */ static BD09ToWGS84: (input: GeoCoordTransformInput) => GeoCoordTransformOutput; /** * `BD09 坐标系` 转 `GCJ02 坐标系`。 * * 应用场景:百度地图坐标转腾讯地图、高德地图坐标。 */ static BD09ToGCJ02: (input: GeoCoordTransformInput) => GeoCoordTransformOutput; } export declare interface GeoCoordTransformInput { /** * 经度。 */ longitude: number; /** * 纬度。 */ latitude: number; } export declare interface GeoCoordTransformOutput { /** * 经度。 */ longitude: number; /** * 纬度。 */ latitude: number; } /** * 返回当前正在运行的脚本所属的 `