- Fixed
instanceVarPrefix
option logic inload()
and added its logic todump()
function.
- Removed object links writing in
dump()
because of unstable work. Output files now may be larger, but it won't affect them anyhow.
⚠️ BREAKING. Read the API Reference to learn the new API.- Now, this library emphasizes serializing Ruby Marshal objects to stringifiable JSON objects. Now you can stringify load()ed JSON object right out of the box.
- Added full-featured BigInt support. Enjoy.
- ((Probably)) Fixed incorrect object links processing, which could've led to missing fields in serialized JSON objects.
- Removed
numeric
,convertHashKeysToString
,hash
,regexp
,convertInstanceVarsToString
options ofload()
function. - Added
instanceVarPrefix
option toload()
function. - Removed
convertStringsToInstanceVar
option ofdump()
function. - Added
instanceVarPrefix
,maxByteLength
options todump()
function.
- Fixed dumping objects'
__type
helper property back to marshal data. - Changed prefixes for objects' keys:
:SYMBOL:
changed to__symbol__
iINTEGERi
changed to__integer__
oOBJECTo
changed to__object__
- Fixed error when loading marshal data using
string: "utf8"
options property along withconvertInstanceVarToString
options property.
-
Hugely improved stringifying load()ed objects potential: For example, instead of parsing object's class as a symbol, it parses class as a string of .__class object property.
-
Added property .__type to some Ruby objects to determine their type when they're stringified and then parsed back.
-
Renamed properties of Ruby objects:
data
to__data
wrapped
to__wrapped
userDefined
to__userDefined
userMarshal
to__userMarshal
classSymbol
to__class
members
to__members
name
to__name
old
to__old
-
Fixed non-working
convertInstanceVarsToString
options property ofdump()
when using empty string.
- Fixed non-working
convertInstanceVarsToString
options property ofload()
when using string.
- Fixed improper handling of
convertInstanceVarsToString
options property ofload()
andconvertStringsToInstanceVar
ofdump()
. - When
hash
property ofload()
is not set tomap
orwrap
, plain object to which Ruby hash is decoded tries to preserve object keys' types by stringifiying these objects, prefixing them with "oOBJECTo" and setting them as object's keys. - Fixed missed type declaration for mjs module.
⚠️ BREAKING. Read the API Reference to learn the new API.- Floats, whether they greater than 1, less than -1, or between -1 and 1, are always parsed correctly now.
- When
hash
property ofload()
is not set tomap
orwrap
, plain object to which Ruby hash is decoded tries to preserve keys' types by prefixing symbols, converted to string with ":SYMBOL:" and integers, converted to string with "iINTEGERi". - Property
hashSymbolKeysToString
ofload()
options was renamed toconvertHashKeysToString
. - Property
ivarToString
ofload()
options was renamed toconvertInstanceVarsToString
. - Property
known
ofload()
options was renamed todecodeKnown
. - Added property
convertStringsToInstanceVar
todump()
options to revert converted in load() instance vars back to their initial form. - Removed property
hashStringKeysToSymbol
ofdump()
options in favor of automatically converting strings to symbols, when it's required. - Property
known
ofdump()
options was renamed toencodeKnown
. - Property
unknown
ofdump()
options was renamed toencodeUnknown
.
- Add
regexp: wrap
to wrap ruby regexp inRubyRegexp
.
- Add
string: utf8 | binary
inload()
to force decode or not decode strings.
- Fix
load(string)
should decode string in each code manually.
⚠️ BREAKING. Read the API Reference to learn the new API.
hashToJS
now also accepts number (Integer, Float) keys.
- Fix mutating default options.
- Add
clone(x, opt)
as a shortcut toload(dump(x), opt)
.
- Fix
hashToJS
,hashToMap
with nested hashes.
- Fix dump Bignum logic.
- Fix dump Hash with default value.
- Fix instance variables logic.
- Add
RubyRange
,RubyTime
helper classes.
- Refactored a lot to make this package smaller.
- Fix
T_EXTENDED
parse and dump behavior. - Support dump circular objects.
- esbuild has inline enum, this package can be smaller and run quicker.
- Changed
exports
field in package.json so that it always use ESM when bundling to browser.
- Fixed parsing circular objects.
- Added
load
optiondecodeString: false
andwrapString: true
- Fixed
dump(new RubyObject())
generates wrong marshal data
- Added
load(arrayBuffer)
to parse marshal data - Added
dump(value)
to dump marshal data (not strictly equal to the ruby ones)