# ID reconciler v1

Compare newline-separated expected and received IDs locally. This free module
is the same implementation as the browser checker, with no dependencies,
network requests, file reads or telemetry. Requires modern JavaScript or Node 18+.

Save `id-reconciler.mjs`, then save the following example beside it as
`check.mjs`. Run `node check.mjs`:

```js
import { checkIdReconciliation } from './id-reconciler.mjs';
const result = checkIdReconciliation('001\n002', '001\n003\n003');
console.log(result);
// checked: 5, issues: 3
// Missing "002": expected line 2.
// Extra "003": received line 2.
// Duplicate received "003": lines 2, 3.
```

`checkIdReconciliation(expected, received)` returns `{ lines, checked, issues }`.
`checked` counts input IDs across both lists, including duplicates. `issues`
counts findings: one per missing ID, extra ID, duplicated expected ID, or
 duplicated received ID. These are membership differences, not quantity
 reconciliation. Both lists are exact case-sensitive text: leading zeros,
 spaces, tabs and whitespace-only IDs are retained. No numeric conversion or
 Unicode normalization occurs. No spreadsheet is read or changed; already-lost
 digits cannot be recovered.

Use one ID per line without a header. CRLF/CR become line breaks. One final
newline is ignored; other empty lines throw an error with the source line.
Either list may be empty, but both empty is an error. Maximum 500 IDs and
100,000 characters per list. Error messages are thrown for invalid inputs.
Findings preserve source line references; displayed IDs longer than 80
characters use a preview and length. Similar previews do not mean equal IDs:
use line references to inspect the originals. Control characters are escaped.

Build: `node scripts/build-id-reconciler.mjs`.
Parity check: `node scripts/build-id-reconciler.mjs --check`.
A source download is not evidence of an independent local run.

## License

MIT License

Copyright (c) 2026 QuasiLife

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
