Changelog
Unreleased
Fixed
isNumeric— stateful regex (src/index.ts:10). Dropped the/gflag soRegExp.prototype.testno longer advanceslastIndexbetween calls. Repeated calls on the same input now return a stabletrue.isInt— rejects negative integers (src/index.ts:16). Replaced the regex withNumber.isInteger(value)so signed integers are accepted.isInt— rejects integers in scientific notation (src/index.ts:16). Same fix —Number.isInteger(1e21)correctly returnstrue.isFloat— rejects negative floats / unescaped.in regex (src/index.ts:22). Regex is now/^-?\d+\.\d+$/(sign branch + escaped.), gated onNumber.isFinitesoNaN/Infinityare rejected.isObject,isRegex,isPlainObject,isPromise,isDate,isGenerator,isIterable— non-boolean falsy returns (multiple lines). Predicates now coerce withBoolean(...)/ explicitvalue !== nullchecks instead of leaking the raw falsy value (null,undefined,0,"").isPlainObject— throws onObject.create(null)(src/index.ts:39). Now short-circuits totruewhen the prototype isnull; otherwise falls back to theconstructor?.name === "Object"check with an optional chain.isPromise— doesn’t recognize subclasses (src/index.ts:79). Switched tovalue instanceof Promise, which accepts subclasses while still rejecting bare thenables.isGenerator— never matches a generator instance (src/index.ts:91). Replaced the constructor-name check with a duck-typed test: object +.nextfunction + self-iterable (value[Symbol.iterator]() === value).isEmpty— returnstruefor non-empty plain objects (src/index.ts:103). Added anObject.keys(value).length === 0fast-path for non-iterable plain objects, so{ a: 1 }is now correctly reported as non-empty.isEmpty— returnstruefornew Date()(src/index.ts:103). Constructed Date instances now short-circuit tofalse.isEmpty— returnstrueforNaN(src/index.ts:103).NaNis now treated as non-empty (it’s still a numeric value).isIterable— returns the empty string instead oftruefor""(src/index.ts:64). Replaced the truthy guard with explicit null/undefined checks so the empty string flows through to theSymbol.iteratortest.isUrl— accepts trailing dots and..(src/index.ts:142). Hostname is now split on.and rejected if any label is empty, sohttps://google.andhttps://google..comboth returnfalse.isEmail— matches single-element arrays (src/index.ts:160). Added atypeof value === "string"guard before the regex test, so arrays / non-strings can’t sneak through viaString()coercion.isSafari— false-positives on class-based DOM polyfills (src/index.ts:273). Replaced the/constructor/i.test(window.HTMLElement)heuristic with a userAgent-based detector that requiresSafariAND excludesChrome|Chromium|Edg|OPR|Android.isOpera— references bareoprglobal (src/index.ts:288). Switched towindow.opr?.addonsso the predicate no longer risks aReferenceErrorin strict mode.isBrowser— duplicated buggy logic forsafari/opera(src/index.ts:243). The function now delegates toisChrome(),isFirefox(),isSafari(),isOpera(),isIE(),isEdge()instead of inlining (and re-introducing) the same bugs.isMobile.any— circular self-reference throughIs(src/index.ts:232). ReplacedIs.mobile.X()calls with directisMobile.X()calls so the object no longer depends on its own export being initialized.
Added
- README.md — marketing-style index with a 30-second tour, a categorized predicate table, an
isEmptysemantics section, an SSR-safety note, and a curated list of known bugs. - CHANGELOG.md — this file.
- AI kit —
llms.txt,llms-full.txt, andskills/cards (README,overview,primitives,collections,formats,misc,environment,recipes). - Test suite — 89 passing tests across
primitives,collections,formats,misc, andenvironment. The suite uses Vitest underhappy-domso DOM-touching predicates (isFormElement,isFormData,isMobile.*,isMac,isBrowser,isChrome/isFirefox/isSafari/isOpera/isIE/isEdge) can be exercised with a configurablenavigator.userAgent. - CI — GitHub Actions matrix: Node 18 / 20 / 22 on Ubuntu plus Node 20 on Windows.
Changed
- Test runner: Jest → Vitest. Tests moved from
tests/tosrc/__tests__/(matches@mongez/atom’s layout) and are organized by category (primitives.test.ts,collections.test.ts,formats.test.ts,misc.test.ts,environment.test.ts). package.json:- Description rewritten to actually describe the package (“tree-shakable type & shape predicates”).
- Added
sideEffects: falseso bundlers can drop unused exports for real. - Keyword list expanded from 10 generic terms to a comprehensive index of every exported predicate.
- Removed Jest config block.
devDependencies: droppedjest,ts-jest,@types/jest,jest-esm-jsx-transform; bumpedtypescriptto^5.4; addedvitest@^2.1andhappy-dom@^15.
Removed
tests/directory (replaced bysrc/__tests__/).- Stale devDeps listed above.
Dependency notes
- Dropped:
jest,ts-jest,@types/jest,jest-esm-jsx-transform. The package no longer carries a Jest config. - Added:
vitest@^2.1,happy-dom@^15. - Bumped:
typescript@^4.5→^5.4. - No runtime dependencies. The package remains zero-dep.
Tests
89 passing + 0 skipped = 89 total across 5 files