Quark #

Modules #

Quark v1.2.0 Documentation


quark/_ext #

number #

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number

  • @type number = Number
  • @global

boolean #

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean

object #

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object

  • @type object = Object
  • @global

string #

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String

  • @type string = String
  • @global

Int #

32-bit signed integer, Range: -2147483648 to 2147483647

Uint #

32-bit signed integer, Range: 0 to 4294967295

Float #

32-bit floating point

  • @type Float = number
  • @global

Interface: Object #

Object #

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object

  • @global

Interface: Dict #

Dict #

Dictionaries

  • @global
  • @template <T>

Interface: Function #

Function #

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function

  • @global

Interface: Array #

Array #

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array

  • @global
  • @template <T>

Interface: String #

String #

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String

  • @global

Interface: Number #

Number #

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number

  • @global

number.toFixedBefore(before,after?) #

Convert to a string with a fixed number of digits before and after the decimal point

  • @param before: Uint Fixed number of digits before the decimal point
  • @param after?: Uint Fixed number of digits after the decimal point
  • @return string

number.toFixedVariable(after,split?,symbol?) #

Fixed the number of digits before the decimal point and used symbol separation

  • @param after: Uint Fixed number of digits before the decimal point
  • @param split?: Uint Split unit length
  • @param symbol?: string Split characters

For example:

// Print: 1,000,000.03
console.log((1000000.03).toFixedVariable(8,3,','))

Interface: Boolean #

Boolean #

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean

  • @global

Interface: Date #

Date #

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

  • @global

date.currentTimezone #

current timezone

  • currentTimezone: Uint
  • @static

date.parseDate(date_str,format?,timezone?) #

Parse a string as a time

  • @param str: The string to parse
  • @param format?: string date format default yyyyMMddhhmmssfff
  • @param timezone?: Uint The time zone of the time to be parsed, the default is the current time zone
  • @return Date Retruu Date object
  • @static

For example:

let i = '2008-02-13 01:12:13';
let date = Date.parseDate(i); // The new time returned

date.formatTimeSpan(ts,format?) #

Formatting timestamps

  • @param time_span: Uint The timestamp to format
  • @param format?: string The timestamp format to be formatted
  • @return string The returned formatted timestamp
  • @static

For example:

// Format timestamp (unit: milliseconds)
let time_span = 10002100;
let format = 'dd hh:mm:ss';
let str = Date.formatTimeSpan(time_span, format); // str = '0 2:46:42'
let format = 'dd天hh时mm分ss秒';
let str = Date.formatTimeSpan(time_span, format); // str = '0天2时46分42秒'
format = 'hh时mm分ss秒';
str = Date.formatTimeSpan(time_span, format); // str = '2时46分42秒'
format = 'mm分ss秒';
str = Date.formatTimeSpan(time_span, format); // str = '166分42秒'
  • @param ts:

date.add(ms) #

Add milliseconds to the current Date time and change the time value

  • @param ms: Uint The millisecond value to append
  • @return Date

date.toString(format?,timezone?) #

Returns a date string given a date format

  • @param format?: string The format of the string to be converted
  • @return string Returns the formatted time string


  • @exmples


let date = new Date();
let format = 'yyyy-MM-dd hh:mm:ss.fff';
let dateStr = date.toString(format); // dateStr的值为 '2008-12-10 10:32:23'
format = 'yyyy-MM-dd hh:mm:ss';
dateStr = date.toString(format); // dateStr的值为 '2008-12-10 10:32:23'
format = 'yyyy/MM/dd';
dateStr = date.toString(format); // dateStr的值为 '2008/12/10'
format = 'yyyy-MM-dd hh';
dateStr = date.toString(format); // dateStr的值为 '2008-12-10 10'

Interface: ErrorDescribe #

ErrorDescribe #

  • @global

ErrnoCode #

The [errno,message,description] of Array

  • @type ErrnoCode = [number,string,string?]
  • @global

ErrorNewArg #

Interface: Error #

Error #

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error

  • @global

error.captureStackTrace(targetObject,constructorOpt?) #

Create .stack property on a target object