npm.io
0.7.0 • Published 8 months ago

@types/javascript-natural-sort

Licence
MIT
Version
0.7.0
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
51.3K

Installation

npm install --save @types/javascript-natural-sort

Summary

This package contains type definitions for javascript-natural-sort (https://github.com/Bill4Time/javascript-natural-sort).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/javascript-natural-sort.

index.d.ts

/**
 * Natural sort comparison function for use with Array.sort().
 * Sorts strings containing numbers in a human-friendly way.
 *
 * @param a - First value to compare
 * @param b - Second value to compare
 * @returns Negative if a < b, positive if a > b, zero if equal
 *
 * @example
 * ```javascript
 * var naturalSort = require('javascript-natural-sort');
 *
 * ['img12', 'img10', 'img2', 'img1'].sort(naturalSort);
 * // => ['img1', 'img2', 'img10', 'img12']
 * ```
 */
declare function naturalSort(a: string | number, b: string | number): number;

declare namespace naturalSort {
    /**
     * Set to true to enable case-insensitive sorting.
     * @default false
     */
    let insensitive: boolean;
}

export = naturalSort;

Additional Details

  • Last updated: Wed, 04 Feb 2026 1832 GMT
  • Dependencies: none

Credits

These definitions were written by gaspard.