Noticeably Playful Monkeys

    @types/listify
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0 • Public • Published

    Installation

    npm install --save @types/listify

    Summary

    This package contains type definitions for listify (https://github.com/ljharb/listify#readme).

    Details

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

    index.d.ts

    // Type definitions for listify 1.0
    // Project: https://github.com/ljharb/listify#readme
    // Definitions by: BendingBender <https://github.com/BendingBender>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
    
    export = listify;
    
    /**
     * Turn an array into a list of comma-separated values, appropriate for use in an English sentence.
     *
     * @example
     * import listify = require('listify');
     * import * as assert from 'node:assert';
     *
     * assert(listify([1, 2]) === '1 and 2');
     * assert(listify([1, 2, 3]) === '1, 2, and 3');
     * assert(listify([1, 2, 3, 4]) === '1, 2, 3, and 4');
     * assert(listify([1, 2, 3], { separator: '… ' }) === '1… 2… and 3');
     * assert(listify([1, 2, 3], { finalWord: false }) === '1, 2, 3');
     * assert(listify([1, 2, 3], { separator: '… ', finalWord: 'or' }) === '1… 2… or 3');
     */
    declare function listify(list: ReadonlyArray<string | number>, options?: listify.Options): string;
    
    declare namespace listify {
        interface Options {
            /**
             * @default ', '
             */
            separator?: string;
            /**
             * @default 'and'
             */
            finalWord?: string | false;
        }
    }

    Additional Details

    • Last updated: Sat, 05 Nov 2022 13:32:54 GMT
    • Dependencies: none
    • Global values: none

    Credits

    These definitions were written by BendingBender.

    Keywords

    none

    Install

    npm i @types/listify

    DownloadsWeekly Downloads

    221

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    4.87 kB

    Total Files

    5

    Last publish

    Collaborators

    • types