{"id":49420,"library":"stable-sort","title":"stable-sort","description":"Typed stable sorting helpers for JavaScript and TypeScript, version 0.1.0, with zero dependencies. Provides explicit stable sort functions (non-mutating and in-place) with migration-friendly aliases for the deprecated 'stable' package. Ships TypeScript types, requires Node >=18. Differentiator: offers a typed, migration-focused API with helpers like compareBy and reverseComparator, as an independent alternative to the unmaintained 'stable'.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/iexitdev/stable-sort","tags":["javascript","stable","sort","stable-sort","comparator","typescript","migration","replacement","deprecated"],"install":[{"cmd":"npm install stable-sort","lang":"bash","label":"npm"},{"cmd":"yarn add stable-sort","lang":"bash","label":"yarn"},{"cmd":"pnpm add stable-sort","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only, no CommonJS export.","wrong":"const stableSort = require('stable-sort')","symbol":"stableSort","correct":"import { stableSort } from 'stable-sort'"},{"note":"compareBy is a named export, not default.","wrong":"import compareBy from 'stable-sort'","symbol":"compareBy","correct":"import { compareBy } from 'stable-sort'"},{"note":"stable is a direct alias for stableSort; avoid double renaming.","wrong":"import { stableSort as stable } from 'stable-sort'","symbol":"stable","correct":"import { stable } from 'stable-sort'"}],"quickstart":{"code":"import { stableSort, compareBy } from 'stable-sort';\ninterface User { name: string; age: number; }\nconst users: User[] = [\n  { name: 'Alice', age: 30 },\n  { name: 'Bob', age: 25 },\n  { name: 'Charlie', age: 30 },\n];\nconst sorted = stableSort(users, compareBy((u) => u.age));\nconsole.log(sorted); // Bob (25), Alice (30), Charlie (30) — stable order","lang":"typescript","description":"Shows typed stable sort with compareBy using a property selector, maintaining stable order for equal ages."},"warnings":[{"fix":"Upgrade Node.js to version 18 or later.","message":"Package requires Node >=18 due to use of modern JavaScript features.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Replace imports from 'stable' with 'stable-sort' using the migration aliases.","message":"The 'stable' package (which stable-sort helps migrate from) is deprecated and no longer maintained.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Use import syntax or switch to dynamic import() if using CommonJS.","message":"stable-sort is ESM-only; attempting to require() it will throw an error.","severity":"breaking","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.1.0':13 '18':44 'alias':33 'altern':62 'api':52 'compar':73 'comparebi':56 'depend':16 'deprec':36,77 'differenti':45 'explicit':18 'focus':51 'friend':32 'function':21 'helper':7,54 'in-plac':26 'independ':61 'javascript':9,67 'like':55 'migrat':31,50,75 'migration-focus':49 'migration-friend':30 'mutat':24 'node':43 'non':23 'non-mut':22 'offer':46 'packag':38 'place':28 'provid':17 'replac':76 'requir':42 'reversecompar':58 'ship':39 'sort':3,6,20,69,72 'stabl':2,5,19,37,66,68,71 'stable-sort':1,70 'type':4,41,48 'typescript':11,40,74 'unmaintain':65 'version':12 'zero':15","created_at":"2026-06-07T17:01:41.682214+00:00","updated_at":"2026-06-07T17:01:41.682214+00:00","problems":[{"fix":"Use import syntax: import { stableSort } from 'stable-sort'; or use dynamic import: await import('stable-sort').","cause":"The package is ESM-only, not compatible with CommonJS require.","error":"ERR_REQUIRE_ESM: require() of ES Module .../node_modules/stable-sort/index.js from ... not supported."},{"fix":"Use named imports: import { stableSort, compareBy } from 'stable-sort'.","cause":"Trying to default import from a package that only has named exports.","error":"SyntaxError: The requested module 'stable-sort' does not provide an export named 'default'"},{"fix":"Ensure you import stableSort correctly: import { stableSort } from 'stable-sort' (ESM) or const { stableSort } = await import('stable-sort') (dynamic).","cause":"Incorrect import or wrong package name.","error":"TypeError: stableSort is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/iexitdev/stable-sort#readme","github":"https://github.com/iexitdev/stable-sort","docs":null,"changelog":null,"pypi":null,"npm":"stable-sort","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}