JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14545664
  • Score
    100M100P100Q213684F
  • License MIT

TypeScript definitions for ms

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@types/ms) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Installation

    npm install --save @types/ms

    Summary

    This package contains type definitions for ms (https://github.com/vercel/ms).

    Details

    Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ms.

    index.d.ts

    /**
     * Short/Long format for `value`.
     *
     * @param {Number} value
     * @param {{long: boolean}} options
     * @return {String}
     */
    declare function ms(value: number, options?: { long: boolean }): string;
    
    /**
     * Parse the given `value` and return milliseconds.
     *
     * @param {ms.StringValue} value
     * @return {Number}
     */
    declare function ms(value: ms.StringValue): number;
    
    declare namespace ms {
        // Unit, UnitAnyCase, and StringValue are backported from ms@3
        // https://github.com/vercel/ms/blob/8b5923d1d86c84a9f6aba8022d416dcf2361aa8d/src/index.ts
    
        type Unit =
            | "Years"
            | "Year"
            | "Yrs"
            | "Yr"
            | "Y"
            | "Weeks"
            | "Week"
            | "W"
            | "Days"
            | "Day"
            | "D"
            | "Hours"
            | "Hour"
            | "Hrs"
            | "Hr"
            | "H"
            | "Minutes"
            | "Minute"
            | "Mins"
            | "Min"
            | "M"
            | "Seconds"
            | "Second"
            | "Secs"
            | "Sec"
            | "s"
            | "Milliseconds"
            | "Millisecond"
            | "Msecs"
            | "Msec"
            | "Ms";
    
        type UnitAnyCase = Unit | Uppercase<Unit> | Lowercase<Unit>;
    
        type StringValue =
            | `${number}`
            | `${number}${UnitAnyCase}`
            | `${number} ${UnitAnyCase}`;
    }
    
    export = ms;
    

    Additional Details

    • Last updated: Thu, 16 Jan 2025 21:02:45 GMT
    • Dependencies: none

    Credits

    These definitions were written by Zhiyuan Wang.