Releases: refractproject/minim
0.20.7
0.20.5
0.20.4
0.20.2
0.19.1
Enhancements
- Serialisers will now throw TypeError with straight forward messages when you
try to serialise a non-element type.
Bug Fixes
-
While accessing meta or attributes of a frozen element that does not contain
meta or attributes, an exception was raised because these accessors would
lazy load and attempt to mutate the element.These accessors will now return an empty frozen
ObjectElement
in these
cases now to prevent mutation. -
Fixes JSON 0.6 Deserialiser to correct deserialise enum elements.
- When multiple sample values were present additional values were being discarded.
- Deserialised enum content contained duplicate enumeration values.
0.19.0
Breaking
- Updated enum serialization/deserialization in the JSON 0.6 serializer to match
apiaryio/api-elements#28 Element.children
andElement.recursiveChildren
now returnArraySlice
instead of anArrayElement
.ArrayElement.filter
andArrayElement.find*
now returnArraySlice
instead of anArrayElement
.- The
first
,second
andlast
methods onArrayElement
are now properties
instead of methods. ObjectElement.filter
now returns anObjectSlice
instead of an
ObjectElement
.- When providing multiple element names to
Element.findRecursive
you must
callfreeze
on the element beforehand so that the element has access to the
parent of the element.
Enhancements
- Introduced JSDoc documentation to public interfaces
Element
now contains afreeze
method to freeze and prevent an element
from being mutated, this also adds a parent property on all child elements.
Bug Fixes
- Handle serializing key-value pair without value
- Deserialize
dataStructure
containing an array correctly
0.18.1
0.18.0
Breaking
-
JSON Serialisation now follows the JSON Refract serialisation rules defined at
https://github.com/refractproject/refract-spec/blob/master/formats/json-refract.md.Existing serialiser is available during a transition period to aid migration
to the new format.const JSONSerialiser = require('minim/serialisers/json-0.6'); const serialiser = new JSONSerialiser(); const element = serialiser.deserialise('Hello'); serialiser.serialise(element);
Enhancements
- ArrayElement high-order functions,
map
,filter
andforEach
now accept
thisArg
like the equivalent functionality inArray
.
0.17.1
0.17.0
Breaking
-
Element.toRefract()
andElement.fromRefract()
have been removed. JSON
Serialisation is now decoupled from the Element model. A minim namespace
provides a conveniencetoRefract(element)
andfromRefract(object)
methods. -
ArrayElement
children
method has been replaced by achildren
property
on all elements. You may now chain children in conjunction withfilter
to
get the existing behaviour.Before:
const numbers = doc.children((element) => element.element == 'number');
After:
const numbers = doc.children.filter((element) => element.element == 'number');
OR
const numbers = doc.children.findByElement('number');
-
BaseElement
has been renamed toElement
. -
Embedded Refract support has been removed.
Enhancements
- All elements now contain a
children
andrecursiveChildren
properties that
return an ArrayElement of the respective children elements. - JSON Serialiser will no longer serialise empty
meta
andattributes
into
JSON objects. - Minim now contains a
RefElement
. - Element now contains a
toRef()
function to create a ref element referencing
the element.