- fix: TypeScript typings (separate
ObserverData
fromEncapsulateObserver
)
- fix:
NodeNext
moduleResolution
- fix: bundling issue
- feat: TypeScript typings
- fix: support distinguishing of +0 and -0
- fix: switch use of Node 14-unsupported
replaceAll
- BREAKING fix: empty string components of key paths are now escaped (as
''
) and''
is escaped as''''
- fix: CJS export
- fix: Set (UMD)
browser
export afterimport
/require
- chore: update devDeps.
- BREAKING feat: move to named exports
- BREAKING feat: Offer ESM (breaks some paths and adds
exports
) - feat: Expose
Typeson.setAtKeyPath
- chore: switches to c8 from nyc for ESM compatibility
- npm: Update devDeps.
- Enhancement: Adds
Typeson.Promise.allSettled
utility for parity with otherPromise
methods
- npm: Switch to pnpm
- npm: Update devDeps.
- Breaking change: Drop peerDeps (core-js-bundle, regenerator-runtime) and
avoid need for
regenerator-runtime
- Docs: Corrected typo (@stephanemagnenat)
- Linting: Lint per lasest ash-nazg; lint hidden file
- Build: Use "json" extension on RC file; indicate
default
exports for Rollup - Editorconfig: Enforce JSON spacing
- Testing: Remove need for bootstrap file
- npm: Add coverage in main
test
script - npm: Switch to server without reported vulnerabilities (
http-server
) - npm: Replace deprecated
rollup-plugin-babel
with@rollup/plugin-babel
and makebabelHelpers
bundled
value explicit - npm: Update devDeps (including changing updated ash-nazg peerDeps.)
- Fix: Avoid treating recurring primitive values as cyclic
- Linting (ESLint): As per latest ash-nazg
- npm: Bump devDeps, peerDeps
- npm: Bumped version as package not seeming to be available for download despite being published
- Enhancement: Allow
TypesonPromise
all
andrace
to work with non-TypesonPromise
- Fix: Allow nested plain objects to async revive
- Fix: Have empty keypath at very front, but nested first otherwise
- Fix: Nested
Undefined
- Fix: Avoid recursion if
undefined
orNaN
/Infinity
/-Infiinity
values return the same - Fix: Ensure
iterateIn
array can have async setting - Testing: Coverage, Intermediate async types
- Docs: Document removing a previously registered spec;
update/clarify
hasConstructorOf
null
behavior
- Fix: Restore old behavior of nullish spec potentially replacing
- Enhancement: Allow nullifying previous
testPlainObjects
specs (by absence oftest
) - npm: Bump devDep.
- Fix: When checking for "null" constructor, return
true
if object created byObject.create(null)
. This fix only impacts direct use ofTypeson.hasConstructorOf
. When internally used in Typeson (ortypeson-registry
), it never uses anull
second argument. - Fix: Throw proper error upon missing reviver
- Fix: Ensure nullish spec is silently ignored
- Fix: Ensure sorting more nested paths first
- Enhancement: Add
engines
(also used in Unicorn linting rule) - Testing: Coverage improvements; use mocha and chai
- npm: Split up browser testing to two scripts
- npm: Update devDeps, peerDep (core-js-bundle)
- Enhancement: Allow cloning during encapsulation of (non-registered)
classes using
Symbol.toStringTag
(#17)
- Fix: Ensure pointing to existent main CJS file (minified)
- Fix: Ensure
this
is defined with old-style function-based type specs - Fix: Ensure
Undefined
andTypesonPromise
revivers are correctly detected (independent of minification or Babelification). - Linting (ESLint): Switch to more rigorous config (ash-nazg); jsdoc, etc.
- Linting (ESLint): add any html to linting
- Maintenance: Add
.editorconfig
- Testing: Add coverage
- npm: Update devDeps/peerDeps
- Enhancement: Add ESM dist format (and use in test and
package.json
); provide non-minified versions - Testing: Avoid need for build file (use
esm
and relative path for browser test) - npm: Indicate
core-js-bundle
andregenerator-runtime
aspeerDependencies
(and devDeps) in place of deprecated@babel/polyfill
- npm: Update
opn-cli
->open-cli
; update devDeps; remove now unusedrollup-plugin-node-resolve
- Linting (ESLint): Update
polyfills
for compat plugin - npm: Update devDeps, including Babel potentially impacting build
- Fix: Sorting issue with plain object revivers (lgtm.com-inspired fix)
- Refactoring: Avoid useless check (lgtm.com-inspired change)
- Fix: Ensure
testPlainObjects
are revived before reference resolution and setting (and before other types) so that objects-to-arrays will be properly referenced in all cases and can thus preserve non-index array properties (fixes #9) - Fix: Allow
iterateIn === 'object
to override array and create object from array - Fix (
reviveAsync
): Wait until all TypesonPromises resolve (no tests still) - Enhancement: Add state object option to auto-copy array length onto array-like object clone
- Optimization: Avoid passing around (unchanging)
opts
within innerrevive
handling - Refactoring: Object property shorthand; avoid shadowing; make return
explicit; use
slice
oversubstr
- Docs: Further JSDoc
- Testing: Report total passed
- Testing (fix): Ensure using
@babel/polyfill
- npm/yarn: Update devDep
- npm: Add yarn to
prepublishOnly
to ensure stays up to date with npmpackage-lock.json
- yarn: Update
yarn.lock
- Fix: Give string tag to
TypesonPromise
to prevent it from passingisUserObject
- Linting (Markdown): Update per newer API
- npm: Update devDeps
- Linting (ESLint): Remove unused file from ignore; apply script to whole
repo save ignore file; override new "standard" rule with own
"object-curly-spacing"; avoid Node-11-deprecated
url.parse
- Linting (ESLint): Actually use compat plugin (identifies need for promises and URL polyfills as a minimum on some older browsers to get full browser coverage)
- Refactoring: Use object shorthand, destructuring
- Build (Rollup): Switch to terser for minification; avoid plugins where not needed
- npm: Update to Babel 7; update other devDeps; switch to base64-arraybuffer-es6
- Fix: Ensure deleted state object properties are restored
- npm: Update devDeps
- Yarn: Update
yarn.lock
- npm: Add
package-lock.json
- Enhancement: Except for
type
andreplaced
states, preserve state object keys (including user-supplied ones) within replacers; add tests - Enhancement: Pass a state object as the second argument to revivers; add tests
- npm: Update devDeps
- Fix
.npmignore
- Build: Add Yarn.lock
- npm: Update dev deps
- Build: Add minification for its own sake and also avoiding our Rollup process (Babel?) unminifying our source and creating inconsistency
- Build: Preminimize internally used constructors so basic functionality not fragile across multiple Typeson instances
- npm: Include typeson.js file with npm in case using as module and also include LICENSE (but ignore new test directory)
- npm: Remove build and prepublish scripts (runs on local installs in npm <= 4)
- Build: Switch from Webpack to Rollup
- npm/Testing: add ESLint script to test routines
- npm/Testing: Add browser test file and npm script
- Testing refactoring: Write tests in ES6
- Testing: Add messages for tests missing them
- gitignore: Ignore new auto-generated test file
- npm: Add
browser
topackage.json
for bundlers
- npm: Add
module
topackage.json
for downstream Rollup/Webpack
- For
encapsulateObserver
, reporttypeDetected
astrue
when a Typeson-detected type is found but no relevant replacer is present to be performed. - For
encapsulateObserver
, reportreplacing
astrue
preceding a Typeson-detected type replacement. (Can be used to get at the original object value before encapsulation) - npm/Testing: Update dev dependencies
- Add back prepublish script to ensure rebuilding upon publish
- Ensure build occurs on install
- Fix
rootTypeName
to work with promises and for replacements
- Breaking change (minor): Throw upon attempts to register objects with JSON type names
- Breaking change (minor): Include JSON type names on
type
property of object passed toencapsulateObserver
- Enhancement (Basic API):
specialTypeNames
instance method to return array of unique Typeson type names - Enhancement (Basic API):
rootTypeName
instance method to return string of Typeson type name at root if present or the JSON type name otherwise - Enhancement (Basic API): Add
Typeson.getJSONType
class method to returnnull
andarray
where appropriate ortypeof
otherwise - Enhancement (Basic API): Add
Typeson.JSON_TYPES
class property to list the available JSON types
-
Breaking change: Use object-based structure on
types
(esp. important as more possible properties/methods are added, reliance on array ordering will become less manageable/intelligible for users). -
Breaking change: Changed default to optimize and avoid replacement checks on arrays unless there is at least one type whose spec has
testPlainObjects
set. Brings consistency given that non-array plain object types must also have the option set to be discoverable. -
Fix: Allow missing recursive array or object member possibilities
-
Fix: Cross-frame/Cross-module plain-object (including
Object.create(null)
) and array detection -
Fix: Escape keypaths to avoid conflicts when property names include dots; fixes #5
-
Fix: Nest inside
$
even if object has$types
that is non-truthy or if it has$types
but no actual types (with tests) -
Fix: Throw if user attempts to define a type with ID "#"
-
Fix: Implementation of pojo registration. The sugar:
typeson.register({MyClass});
failed if parsingundefined
ornull
since the tester did not check for that. -
Enhancement (Basic API): Avoid needing a replacer (so that it can add state config without modifying the object and e.g., set to iterate "in" properties; also can be used for validation only)
-
Enhancement (Basic API): Allow
fallback
option toregister
to assign lower priority to a later registration addition -
Enhancement (Basic API): Support object-based API in addition to function/array (with properties,
test
,replace
,revive
);this
context is supplied object -
Enhancement (Basic API): Allow per-method-invocation options on
encapsulate
/stringify
/revive
/parse
-
Enhancement (Basic API): Support
encapsulateObserver
callback option (sending detectedtype
when present), adding tests for sync and async -
Enhancement (Types): Allow
encapsulate
to represent primitives andrevive
to revive them as such (e.g., to encode a bareundefined
in the same manner asundefined
properties) -
Enhancement (Types): Allow revival to return instanceof
Typeson.Undefined
to indicate restoring toundefined
-
Enhancement (Types): Add config
testPlainObjects
(which can also work with arrays) to allow (non-recursive) tests and replacements for plain objects (or arrays) -
Enhancement (async):
stringifyAsync
,parseAsync
,encapsulateAsync
,reviveAsync
methods which return promises; have them usereplaceAsync
andreviveAsync
on type specs where relevant -
Enhancement (async): Add
throwOnBadSyncType
option (defaults totrue
) which the*Sync/Async
methods automatically apply -
Enhancement (async): Rather than relying on Promises proper (which could be desired as encapsulation results, at least as targets for throwing (e.g., Structured Cloning Throwing in
typeson-registry
)), require use of aTypeson.Promise()
(which supports promise methods) to indicate a result is to be obtained asynchronously. -
Enhancement (utility): Expose
isObject
,isPlainObject
,isUserObject
, andisThenable
as class methods ofTypeson
-
Enhancement (utility): Allow
Typeson.hasConstructorOf
to be tested against classes without constructors -
Enhancement (utility): Add
compareConstructors
method for detection of instances likeIntl.Collator
whosetoStringTag
is indistinguishable from other classes; document -
Enhancement (utility): Add
Typeson.toStringTag
class method given frequent need by types -
Enhancement (utility): Add
escapeKeyPathComponent
,unescapeKeyPathComponent
, andgetByKeyPath
as class methods ofTypeson
-
Enhancement (key iteration): Allow setting of
iterateIn
state ('object' or 'array') by type methods to give purely modular control and ensure iteration on prototype only occurs when set by the type (e.g., so not iterating iterating all objects unless detected as such);iterateIn
defaults to not being set. -
Enhancement (key iteration): Allow setting of
iterateUnsetNumeric
boolean state object property to give purely modular control and ensure iteration of unset (sparse) numeric array indexes only occurs when set by the type (e.g., so not iterating iterating all arrays unless detected as such); defaults tofalse
-
Testing (fix): Prevent
ArrayBuffer
detection clashing with other types -
Testing bugs: Add test for current behavior of replacer (tester/encapsulator) ordering
-
Testing bugs: Keypaths with property names including dots
-
Testing bugs: Test for clashes with objects using own
$
and$types
properties -
Testing bugs: Ensure preventing types with ID "#"
-
Testing features: Add encapsulate observer tests
-
Testing features: Add
toJSON
tests -
Testing features: Add
Typeson.Promise
all
/race
tests -
Testing features: Support promise-based tests
-
Docs (README): Document new features
-
Docs (README): Describe more of the resulting encapsulated structure
-
Docs (README): Document recursive nature of replacements (and promises)
-
Docs (README): Indicate sequence upon subsequent
register
calls -
Docs (README): Indicate precedence of testing/encapsulating when an array is supplied
-
Docs (README): Indicate support for arrays and primitives at root by return of new object
-
Docs (README): summarize properties and specify types consistently in headers
-
Docs (README): Use backticks to set off code references
-
Docs (README): Improve headings hierarchy, more descriptions and documentation of async/sync methods
-
npm: Update dev dependencies
- Enhancement: Allow reviver to set the explicit value
undefined
(by returning an instance ofTypeson.Undefined
) - Enhancement: Pass in state objects to tests and replacers so that they can vary their results depending on setting (currently only whether we are iterating an "own" key property or not)
- Refactoring: Remove redundant nullish-check
- Clean-up: Remove trailing WS, consistent semi-colon usage
- Docs: Consistent and best practices heading hierarchy in README
- Docs: Mention use of tester for throwing exceptions
- Docs: Add docs for
stateObj
- Docs: Add docs for
undefined
behavior in encapsulators and revivers, the use ofTypeson.Undefined
to explicitly addundefined