Comparing version 1.5.3 to 1.5.4
@@ -0,1 +1,4 @@ | ||
# 1.5.4 | ||
* #113: Fix interpolation problem with IE11 by @danfma | ||
# 1.5.3 | ||
@@ -2,0 +5,0 @@ * #105: Support prop schemas for "*" properties by @pyrogenic |
@@ -428,3 +428,3 @@ /** | ||
function checkStarSchemaInvariant(propDef) { | ||
invariant(propDef === true || propDef.pattern, `prop schema '*' can only be used with 'true' or a prop def with a 'pattern': ${JSON.stringify(propDef)}`); | ||
invariant(propDef === true || propDef.pattern, "prop schema '*' can only be used with 'true' or a prop def with a 'pattern': " + JSON.stringify(propDef)); | ||
} | ||
@@ -431,0 +431,0 @@ |
/** serializr - (c) Michel Weststrate 2016 - MIT Licensed */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("serializr",["exports"],t):t((e=e||self).serializr={})}(this,function(e){"use strict";var t={j:function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}};function n(e,n){if(!e){var r=Array.prototype.slice.call(arguments,2),i=[],o=0,a=n.replace(/%([a-zA-Z%])/g,function(e,n){if("%%"===e)return e;var a=t[n];if("function"==typeof a){var s=r[o++];return i.push(s),a(s)}return e});throw console&&i.length>0&&console.log.apply(console,i),new Error("[serializr] "+(a||"Illegal State"))}}function r(e){if(e)throw new Error(e)}function i(e,t,n){if(0!==e.length){var r=e.filter(function(){return!0}).length,i=[],o=!1;e.forEach(function(e,a){t(e,function(e,t,a){t?o||(o=!0,n(t)):(i[e]=a,0==--r&&n(null,i))}.bind(null,a),a)})}else n(null,[])}function o(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function a(e){return e&&e.factory&&e.props}function s(e){return e&&e.serializer&&e.deserializer}function f(e){return"object"==typeof e&&!!e.jsonname}function c(e){return"object"==typeof e&&!0===e.identifier}function u(e,t){for(;e;){if(e===t)return!0;e=e["extends"]}return!1}function l(e){return e&&"function"==typeof e.keys&&"function"==typeof e.clear}function p(e,t){if(t){n(s(e),"expected a propSchema");["beforeDeserialize","afterDeserialize"].forEach(function(n){"function"==typeof t[n]&&(e[n]=t[n])})}return e}function d(e){return e?a(e)?e:a(e.serializeInfo)?e.serializeInfo:e.constructor&&e.constructor.serializeInfo?e.constructor.serializeInfo:void 0:null}function h(e,t){return n(a(t)),e.serializeInfo=t}function y(e,t,r){n(e!==Object,"one cannot simply put define a model schema for Object"),n("function"==typeof e,"expected constructor function");var i={targetClass:e,factory:r||function(){return new e},props:t};if(e.prototype.constructor!==Object){var o=d(e.prototype.constructor);o&&o.targetClass!==e&&(i["extends"]=o)}return h(e,i),i}function m(e){var t={serializer:function(e){return n(o(e),"this value is not primitive: "+e),e},deserializer:function(e,t){o(e)?t(null,e):t("[serializr] this value is not primitive: "+e)}};return t=p(t,e)}var g="undefined"!=typeof Symbol?Symbol("SKIP"):{SKIP:!0},b=m(),v=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,z=/([^\s,]+)/g;function j(e,t,r,i){var o,a,f;if(n(arguments.length>=2,"too few arguments. Please use @serializable as property decorator"),r===undefined&&"function"==typeof t&&t.prototype&&i!==undefined&&"number"==typeof i){n(s(e),"Constructor params must use alias(name)"),n(e.jsonname,"Constructor params must use alias(name)");var c=(a=t.toString().replace(v,""),null===(f=a.slice(a.indexOf("(")+1,a.indexOf(")")).match(z))&&(f=[]),f);c.length>=i&&(r=c[i],e.paramNumber=i,i=undefined,t=t.prototype,o=function(e){for(var n=[],r=0;r<t.constructor.length;r++)Object.keys(e.modelSchema.props).forEach(function(t){var i=e.modelSchema.props[t];i.paramNumber===r&&(n[r]=e.json[i.jsonname])});return new(Function.prototype.bind.apply(t.constructor,[null].concat(n)))})}n("string"==typeof r,"incorrect usage of @serializable decorator");var u=d(t);return u&&t.constructor.hasOwnProperty("serializeInfo")||(u=y(t.constructor,{},o)),u&&u.targetClass!==t.constructor&&(u=y(t.constructor,{},o)),u.props[r]=e,!i||i.get||i.set||(i.writable=!0),i}function x(e,t){n(1===arguments.length||2===arguments.length,"serialize expects one or 2 arguments");var r=1===arguments.length?e:t,i=1===arguments.length?null:e;if(Array.isArray(r)){if(0===r.length)return[];i?"object"!=typeof i&&(i=d(i)):i=d(r[0])}else i?"object"!=typeof i&&(i=d(i)):i=d(r);return n(!!i,"Failed to find default schema for "+e),Array.isArray(r)?r.map(function(e){return C(i,e)}):C(i,r)}function R(e){n(!0===e||e.pattern,`prop schema '*' can only be used with 'true' or a prop def with a 'pattern': ${JSON.stringify(e)}`)}function C(e,t){var r;return n(e&&"object"==typeof e&&e.props,"Expected schema"),n(t&&"object"==typeof t,"Expected object"),r=e["extends"]?C(e["extends"],t):{},Object.keys(e.props).forEach(function(n){var i=e.props[n];if("*"!==n){if(!0===i&&(i=b),!1!==i){var a=i.serializer(t[n],n,t);a!==g&&(r[i.jsonname||n]=a)}}else!function(e,t,n,r){for(var i in R(t),n)if(n.hasOwnProperty(i)&&!(i in e.props)&&(!0===t||t.pattern&&t.pattern.test(i))){var a=n[i];if(!0===t)o(a)&&(r[i]=a);else if(t.props){var s=x(t,a);if(s===g)return;r[i]=s}else{var s=t.serializer(a,i,n);if(s===g)return;r[i]=s}}}(e,i,t,r)}),r}var S=new WeakMap;function w(e,t,n,i,o){this.parentContext=e,this.isRoot=!e,this.pendingCallbacks=0,this.pendingRefsCount=0,this.onReadyCb=i||r,this.json=n,this.target=null,this.hasError=!1,this.modelSchema=t,this.isRoot?(this.rootContext=this,this.args=o,this.pendingRefs={},this.resolvedRefs={}):(this.rootContext=e.rootContext,this.args=e.args)}function k(e,t){for(var n in e.props)if("object"==typeof e.props[n]&&e.props[n].jsonname===t)return!0;return!1}function A(e,t,i,o,a){if(null!==i&&i!==undefined&&"object"==typeof i){var s=new w(e,t,i,o,a),f=t.factory(s);n(!!f,"No object returned from factory"),s.setTarget(f);var c=s.createCallback(r);return O(s,t,i,f),c(),f}o(null,null)}function O(e,t,i,a){t["extends"]&&O(e,t["extends"],i,a),Object.keys(t.props).forEach(function(s){var f=t.props[s];if("*"!==s){if(!0===f&&(f=b),!1!==f){var c=f.jsonname||s;E(function(t,n){t||n===undefined||function(t,n,r){t.deserializer(n,function o(s){return function(f,c){D(function(n,i){n&&i!==undefined&&"function"==typeof t.afterDeserialize?t.deserializer(i,o(s),e,a[r]):s(n,i)},f,c,n,i,r,e,t)}}(e.rootContext.createCallback(function(e){e!==g&&(a[r]=e)})),e,a[r])}(f,n,s)},i[c],i,c,e,f)}}else!function(e,t,i,a,s){for(var f in R(i),s)if(!(f in t.props||k(t,f))){var c=s[f];if(!0===i)n(o(c),"encountered non primitive value while deserializing '*' properties in property '"+f+"': "+c),a[f]=c;else if(i.pattern.test(f))if(i.factory){var u=A(e,i,c,e.callback||r,{});u!==undefined&&(a[f]=u)}else{function l(e){e!==g&&(a[f]=e)}i.deserializer(c,e.rootContext.createCallback(l),e)}}}(e,t,f,a,i)})}function E(e,t,n,r,i,o){o&&"function"==typeof o.beforeDeserialize?o.beforeDeserialize(e,t,n,r,i,o):e(null,t)}function D(e,t,n,r,i,o,a,s){s&&"function"==typeof s.afterDeserialize?s.afterDeserialize(e,t,n,r,i,o,a,s):e(t,n)}function I(e,t){n("object"==typeof e||"function"==typeof e,"No modelschema provided. If you are importing it from another file be aware of circular dependencies.");var r={serializer:function(t){return n(a(e=d(e)),"expected modelSchema, got "+e),null===t||t===undefined?t:x(e,t)},deserializer:function(r,i,o){n(a(e=d(e)),"expected modelSchema, got "+e),null!==r&&r!==undefined?A(o,e,r,i,t):i(null,r)}};return r=p(r,t)}function N(e,t,r){n(!!e,"No modelschema provided. If you are importing it from another file be aware of circular dependencies.");var i,o=!1;function s(){if(o=!0,n("string"!=typeof e||t&&"function"==typeof t,"if the reference target is specified by attribute name, a lookup function is required"),n(!t||"function"==typeof t,"second argument should be a lookup function or additional arguments object"),"string"==typeof e)i=e;else{var r=d(e);n(a(r),"expected model schema or string as first argument for 'ref', got "+r),t=t||function(e){return function(t,n,r){r.rootContext.await(e,t,n)}}(r),i=function(e){for(n(a(e));e;){for(var t in e.props)if("object"==typeof e.props[t]&&!0===e.props[t].identifier)return t;e=e["extends"]}return null}(r),n(!!i,"provided model schema doesn't define an identifier() property and cannot be used by 'ref'.")}}"object"==typeof t&&r===undefined&&(r=t,t=undefined);var f={serializer:function(e){return o||s(),e?e[i]:null},deserializer:function(e,n,r){o||s(),null===e||e===undefined?n(null,e):t(e,n,r)}};return f=p(f,r)}function P(e,t){n(s(e=e||b),"expected prop schema as first argument"),n(!f(e),"provided prop is aliased, please put aliases first");var r={serializer:function(t){return t===undefined?g:(n(t&&"length"in t&&"map"in t,"expected array (like) object"),t.map(e.serializer))},deserializer:function(t,n,r){Array.isArray(t)?i(t,function(n,i,o){function a(t,a){"function"==typeof e.afterDeserialize?D(s,t,a,n,o,r,e):i(t,a)}function s(t,n){t&&n!==undefined&&"function"==typeof e.afterDeserialize?e.deserializer(n,a,r):i(t,n)}E(function(t,n){t?i(t):e.deserializer(n,a,r)},n,t,o,r,e)},n):n("[serializr] expected JSON array")}};return r=p(r,t)}w.prototype.createCallback=function(e){return this.pendingCallbacks++,function(e){var t=!1;return function(){if(!t)return t=!0,e.apply(null,arguments);n(!1,"callback was invoked twice")}}(function(t,n){t?this.hasError||(this.hasError=!0,this.onReadyCb(t),S["delete"](this)):this.hasError||(e(n),--this.pendingCallbacks===this.pendingRefsCount&&(this.pendingRefsCount>0?(this.onReadyCb(new Error('Unresolvable references in json: "'+Object.keys(this.pendingRefs).filter(function(e){return this.pendingRefs[e].length>0},this).join('", "')+'"')),S["delete"](this)):(this.onReadyCb(null,this.target),S["delete"](this))))}.bind(this))},w.prototype.await=function(e,t,r){if(n(this.isRoot),t in this.resolvedRefs){var i=this.resolvedRefs[t].filter(function(t){return u(t.modelSchema,e)})[0];if(i)return void r(null,i.value)}this.pendingRefsCount++,this.pendingRefs[t]||(this.pendingRefs[t]=[]),this.pendingRefs[t].push({modelSchema:e,uuid:t,callback:r})},w.prototype.resolve=function(e,t,r){if(n(this.isRoot),this.resolvedRefs[t]||(this.resolvedRefs[t]=[]),this.resolvedRefs[t].push({modelSchema:e,value:r}),t in this.pendingRefs)for(var i=this.pendingRefs[t].length-1;i>=0;i--){var o=this.pendingRefs[t][i];u(e,o.modelSchema)&&(this.pendingRefs[t].splice(i,1),this.pendingRefsCount--,o.callback(null,r))}},w.prototype.setTarget=function(e){this.isRoot&&this.target&&S["delete"](this.target),this.target=e,S.set(this.target,this)},w.prototype.cancelAwaits=function(){n(this.isRoot);var e=this;Object.keys(this.pendingRefs).forEach(function(t){e.pendingRefs[t].forEach(function(n){e.pendingRefsCount--,n.callback(new Error("Reference resolution canceled for "+t))})}),this.pendingRefs={},this.pendingRefsCount=0},e.createSimpleSchema=function(e){return{factory:function(){return{}},props:e}},e.createModelSchema=y,e.getDefaultModelSchema=d,e.setDefaultModelSchema=h,e.serializable=function(e,t,r){if(1===arguments.length){var i=!0===e?b:e;return n(s(i),"@serializable expects prop schema"),j.bind(null,i)}return j(m(),e,t,r)},e.serialize=x,e.serializeAll=function(e,t){let r,i=!1;function o(e){var t=d(e);return t&&e.hasOwnProperty("serializeInfo")||h(e,t=y(e,{})),d(e).props["*"]=r,e}return 1===arguments.length?(n("function"==typeof e,"@serializeAll can only be used as class decorator"),r=!0,i=!0):(n("object"==typeof e&&e.test,"@serializeAll pattern doesn't have test"),"function"==typeof t&&(t=I(t)),n("object"==typeof t&&t.serializer,"couldn't resolve schema"),r=Object.assign({},t,{pattern:e})),i?o(e):o},e.cancelDeserialize=function(e){n("object"==typeof e&&e&&!Array.isArray(e),"cancelDeserialize needs an object");var t,r=(t=e,S.get(t));r&&r.cancelAwaits()},e.deserialize=function(e,t,o,s){if(n(arguments.length>=2,"deserialize expects at least 2 arguments"),n(a(e=d(e)),"first argument should be model schema"),Array.isArray(t)){var f=[];return i(t,function(t,n){var r=A(null,e,t,n,s);f.push(r)},o||r),f}return A(null,e,t,o,s)},e.update=function(e,t,i,o,s){2===arguments.length||"function"==typeof arguments[2]?(e=d(t=arguments[0]),i=arguments[1],o=arguments[2],s=arguments[3]):e=d(e),n(a(e),"update failed to determine schema"),n("object"==typeof t&&t&&!Array.isArray(t),"update needs an object");var f=new w(null,e,i,o,s);f.setTarget(t);var c=f.createCallback(r),u=O(f,e,i,t);return c(),u},e.primitive=m,e.identifier=function(e,t){var r,i;"function"==typeof e?(r=e,i=t):i=e,n(!i||"object"==typeof i,"Additional property arguments should be an object, register function should be omitted or a funtion");var o={identifier:!0,serializer:b.serializer,deserializer:function(e,t,n){b.deserializer(e,function(e,i){!function(e,t,n){n.rootContext.resolve(n.modelSchema,e,n.target)}(i,n.target,n),r&&r(i,n.target,n),t(e,i)})}};return o=p(o,i)},e.date=function(e){var t={serializer:function(e){return null===e||e===undefined?e:(n(e instanceof Date,"Expected Date object"),e.getTime())},deserializer:function(e,t){null!==e&&e!==undefined?t(null,new Date(e)):t(null,e)}};return t=p(t,e)},e.alias=function(e,t){return n(e&&"string"==typeof e,"expected prop name as first argument"),n(s(t=t&&!0!==t?t:b),"expected prop schema as second argument"),n(!f(t),"provided prop is already aliased"),{jsonname:e,serializer:t.serializer,deserializer:t.deserializer,identifier:c(t),beforeDeserialize:t.beforeDeserialize,afterDeserialize:t.afterDeserialize}},e.custom=function(e,t,r){n("function"==typeof e,"first argument should be function"),n("function"==typeof t,"second argument should be a function or promise");var i={serializer:e,deserializer:function(e,n,i,o){4===t.length?t(e,i,o,n,r):n(null,t(e,i,o,null,r))}};return i=p(i,r)},e.object=I,e.child=I,e.optional=function(e,t){n(s(t=t&&!0!==t?t:b),"expected prop schema as second argument");const r=t.serializer;return n("function"==typeof r,"expected prop schema to have a callable serializer"),Object.assign({},t,{serializer:function(...e){const t=r(...e);return t===undefined?g:t}})},e.reference=N,e.ref=N,e.list=P,e.map=function(e,t){n(s(e=e||b),"expected prop schema as first argument"),n(!f(e),"provided prop is aliased, please put aliases first");var r={serializer:function(t){n(t&&"object"==typeof t,"expected object or Map");var r=l(t),i={};if(r)t.forEach(function(t,n){i[n]=e.serializer(t)});else for(var o in t)i[o]=e.serializer(t[o]);return i},deserializer:function(n,r,i,o){if(n&&"object"==typeof n){var a=Object.keys(n);P(e,t).deserializer(a.map(function(e){return n[e]}),function(e,t){if(e)r(e);else{var n,i=l(o);i?(o.clear(),n=o):n={};for(var s=0,f=a.length;s<f;s++)i?n.set(a[s],t[s]):n[a[s]]=t[s];r(null,n)}},i)}else r("[serializr] expected JSON object")}};return r=p(r,t)},e.mapAsArray=function(e,t,r){n(s(e=e||b),"expected prop schema as first argument"),n(!!t,"expected key property name as second argument");var i={serializer:function(t){n(t&&"object"==typeof t,"expected object or Map");var r=l(t),i=[];if(r)t.forEach(function(t){i.push(e.serializer(t))});else for(var o in t)i.push(e.serializer(t[o]));return i},deserializer:function(n,i,o,a){P(e,r).deserializer(n,function(e,r){if(e)i(e);else{var o,s=l(a);s?(a.clear(),o=a):o={};for(var f=0,c=n.length;f<c;f++)s?o.set(r[f][t],r[f]):o[r[f][t].toString()]=r[f];i(null,o)}},o)}};return i=p(i,r)},e.raw=function(e){var t={serializer:function(e){return e},deserializer:function(e,t){t(null,e)}};return t=p(t,e)},e.SKIP=g,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("serializr",["exports"],t):t((e=e||self).serializr={})}(this,function(e){"use strict";var t={j:function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}};function n(e,n){if(!e){var r=Array.prototype.slice.call(arguments,2),i=[],o=0,a=n.replace(/%([a-zA-Z%])/g,function(e,n){if("%%"===e)return e;var a=t[n];if("function"==typeof a){var s=r[o++];return i.push(s),a(s)}return e});throw console&&i.length>0&&console.log.apply(console,i),new Error("[serializr] "+(a||"Illegal State"))}}function r(e){if(e)throw new Error(e)}function i(e,t,n){if(0!==e.length){var r=e.filter(function(){return!0}).length,i=[],o=!1;e.forEach(function(e,a){t(e,function(e,t,a){t?o||(o=!0,n(t)):(i[e]=a,0==--r&&n(null,i))}.bind(null,a),a)})}else n(null,[])}function o(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function a(e){return e&&e.factory&&e.props}function s(e){return e&&e.serializer&&e.deserializer}function f(e){return"object"==typeof e&&!!e.jsonname}function c(e){return"object"==typeof e&&!0===e.identifier}function u(e,t){for(;e;){if(e===t)return!0;e=e["extends"]}return!1}function l(e){return e&&"function"==typeof e.keys&&"function"==typeof e.clear}function p(e,t){if(t){n(s(e),"expected a propSchema");["beforeDeserialize","afterDeserialize"].forEach(function(n){"function"==typeof t[n]&&(e[n]=t[n])})}return e}function d(e){return e?a(e)?e:a(e.serializeInfo)?e.serializeInfo:e.constructor&&e.constructor.serializeInfo?e.constructor.serializeInfo:void 0:null}function h(e,t){return n(a(t)),e.serializeInfo=t}function y(e,t,r){n(e!==Object,"one cannot simply put define a model schema for Object"),n("function"==typeof e,"expected constructor function");var i={targetClass:e,factory:r||function(){return new e},props:t};if(e.prototype.constructor!==Object){var o=d(e.prototype.constructor);o&&o.targetClass!==e&&(i["extends"]=o)}return h(e,i),i}function m(e){var t={serializer:function(e){return n(o(e),"this value is not primitive: "+e),e},deserializer:function(e,t){o(e)?t(null,e):t("[serializr] this value is not primitive: "+e)}};return t=p(t,e)}var g="undefined"!=typeof Symbol?Symbol("SKIP"):{SKIP:!0},b=m(),v=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,z=/([^\s,]+)/g;function j(e,t,r,i){var o,a,f;if(n(arguments.length>=2,"too few arguments. Please use @serializable as property decorator"),r===undefined&&"function"==typeof t&&t.prototype&&i!==undefined&&"number"==typeof i){n(s(e),"Constructor params must use alias(name)"),n(e.jsonname,"Constructor params must use alias(name)");var c=(a=t.toString().replace(v,""),null===(f=a.slice(a.indexOf("(")+1,a.indexOf(")")).match(z))&&(f=[]),f);c.length>=i&&(r=c[i],e.paramNumber=i,i=undefined,t=t.prototype,o=function(e){for(var n=[],r=0;r<t.constructor.length;r++)Object.keys(e.modelSchema.props).forEach(function(t){var i=e.modelSchema.props[t];i.paramNumber===r&&(n[r]=e.json[i.jsonname])});return new(Function.prototype.bind.apply(t.constructor,[null].concat(n)))})}n("string"==typeof r,"incorrect usage of @serializable decorator");var u=d(t);return u&&t.constructor.hasOwnProperty("serializeInfo")||(u=y(t.constructor,{},o)),u&&u.targetClass!==t.constructor&&(u=y(t.constructor,{},o)),u.props[r]=e,!i||i.get||i.set||(i.writable=!0),i}function x(e,t){n(1===arguments.length||2===arguments.length,"serialize expects one or 2 arguments");var r=1===arguments.length?e:t,i=1===arguments.length?null:e;if(Array.isArray(r)){if(0===r.length)return[];i?"object"!=typeof i&&(i=d(i)):i=d(r[0])}else i?"object"!=typeof i&&(i=d(i)):i=d(r);return n(!!i,"Failed to find default schema for "+e),Array.isArray(r)?r.map(function(e){return C(i,e)}):C(i,r)}function R(e){n(!0===e||e.pattern,"prop schema '*' can only be used with 'true' or a prop def with a 'pattern': "+JSON.stringify(e))}function C(e,t){var r;return n(e&&"object"==typeof e&&e.props,"Expected schema"),n(t&&"object"==typeof t,"Expected object"),r=e["extends"]?C(e["extends"],t):{},Object.keys(e.props).forEach(function(n){var i=e.props[n];if("*"!==n){if(!0===i&&(i=b),!1!==i){var a=i.serializer(t[n],n,t);a!==g&&(r[i.jsonname||n]=a)}}else!function(e,t,n,r){for(var i in R(t),n)if(n.hasOwnProperty(i)&&!(i in e.props)&&(!0===t||t.pattern&&t.pattern.test(i))){var a=n[i];if(!0===t)o(a)&&(r[i]=a);else if(t.props){var s=x(t,a);if(s===g)return;r[i]=s}else{var s=t.serializer(a,i,n);if(s===g)return;r[i]=s}}}(e,i,t,r)}),r}var S=new WeakMap;function w(e,t,n,i,o){this.parentContext=e,this.isRoot=!e,this.pendingCallbacks=0,this.pendingRefsCount=0,this.onReadyCb=i||r,this.json=n,this.target=null,this.hasError=!1,this.modelSchema=t,this.isRoot?(this.rootContext=this,this.args=o,this.pendingRefs={},this.resolvedRefs={}):(this.rootContext=e.rootContext,this.args=e.args)}function k(e,t){for(var n in e.props)if("object"==typeof e.props[n]&&e.props[n].jsonname===t)return!0;return!1}function A(e,t,i,o,a){if(null!==i&&i!==undefined&&"object"==typeof i){var s=new w(e,t,i,o,a),f=t.factory(s);n(!!f,"No object returned from factory"),s.setTarget(f);var c=s.createCallback(r);return O(s,t,i,f),c(),f}o(null,null)}function O(e,t,i,a){t["extends"]&&O(e,t["extends"],i,a),Object.keys(t.props).forEach(function(s){var f=t.props[s];if("*"!==s){if(!0===f&&(f=b),!1!==f){var c=f.jsonname||s;E(function(t,n){t||n===undefined||function(t,n,r){t.deserializer(n,function o(s){return function(f,c){D(function(n,i){n&&i!==undefined&&"function"==typeof t.afterDeserialize?t.deserializer(i,o(s),e,a[r]):s(n,i)},f,c,n,i,r,e,t)}}(e.rootContext.createCallback(function(e){e!==g&&(a[r]=e)})),e,a[r])}(f,n,s)},i[c],i,c,e,f)}}else!function(e,t,i,a,s){for(var f in R(i),s)if(!(f in t.props||k(t,f))){var c=s[f];if(!0===i)n(o(c),"encountered non primitive value while deserializing '*' properties in property '"+f+"': "+c),a[f]=c;else if(i.pattern.test(f))if(i.factory){var u=A(e,i,c,e.callback||r,{});u!==undefined&&(a[f]=u)}else{function l(e){e!==g&&(a[f]=e)}i.deserializer(c,e.rootContext.createCallback(l),e)}}}(e,t,f,a,i)})}function E(e,t,n,r,i,o){o&&"function"==typeof o.beforeDeserialize?o.beforeDeserialize(e,t,n,r,i,o):e(null,t)}function D(e,t,n,r,i,o,a,s){s&&"function"==typeof s.afterDeserialize?s.afterDeserialize(e,t,n,r,i,o,a,s):e(t,n)}function I(e,t){n("object"==typeof e||"function"==typeof e,"No modelschema provided. If you are importing it from another file be aware of circular dependencies.");var r={serializer:function(t){return n(a(e=d(e)),"expected modelSchema, got "+e),null===t||t===undefined?t:x(e,t)},deserializer:function(r,i,o){n(a(e=d(e)),"expected modelSchema, got "+e),null!==r&&r!==undefined?A(o,e,r,i,t):i(null,r)}};return r=p(r,t)}function N(e,t,r){n(!!e,"No modelschema provided. If you are importing it from another file be aware of circular dependencies.");var i,o=!1;function s(){if(o=!0,n("string"!=typeof e||t&&"function"==typeof t,"if the reference target is specified by attribute name, a lookup function is required"),n(!t||"function"==typeof t,"second argument should be a lookup function or additional arguments object"),"string"==typeof e)i=e;else{var r=d(e);n(a(r),"expected model schema or string as first argument for 'ref', got "+r),t=t||function(e){return function(t,n,r){r.rootContext.await(e,t,n)}}(r),i=function(e){for(n(a(e));e;){for(var t in e.props)if("object"==typeof e.props[t]&&!0===e.props[t].identifier)return t;e=e["extends"]}return null}(r),n(!!i,"provided model schema doesn't define an identifier() property and cannot be used by 'ref'.")}}"object"==typeof t&&r===undefined&&(r=t,t=undefined);var f={serializer:function(e){return o||s(),e?e[i]:null},deserializer:function(e,n,r){o||s(),null===e||e===undefined?n(null,e):t(e,n,r)}};return f=p(f,r)}function P(e,t){n(s(e=e||b),"expected prop schema as first argument"),n(!f(e),"provided prop is aliased, please put aliases first");var r={serializer:function(t){return t===undefined?g:(n(t&&"length"in t&&"map"in t,"expected array (like) object"),t.map(e.serializer))},deserializer:function(t,n,r){Array.isArray(t)?i(t,function(n,i,o){function a(t,a){"function"==typeof e.afterDeserialize?D(s,t,a,n,o,r,e):i(t,a)}function s(t,n){t&&n!==undefined&&"function"==typeof e.afterDeserialize?e.deserializer(n,a,r):i(t,n)}E(function(t,n){t?i(t):e.deserializer(n,a,r)},n,t,o,r,e)},n):n("[serializr] expected JSON array")}};return r=p(r,t)}w.prototype.createCallback=function(e){return this.pendingCallbacks++,function(e){var t=!1;return function(){if(!t)return t=!0,e.apply(null,arguments);n(!1,"callback was invoked twice")}}(function(t,n){t?this.hasError||(this.hasError=!0,this.onReadyCb(t),S["delete"](this)):this.hasError||(e(n),--this.pendingCallbacks===this.pendingRefsCount&&(this.pendingRefsCount>0?(this.onReadyCb(new Error('Unresolvable references in json: "'+Object.keys(this.pendingRefs).filter(function(e){return this.pendingRefs[e].length>0},this).join('", "')+'"')),S["delete"](this)):(this.onReadyCb(null,this.target),S["delete"](this))))}.bind(this))},w.prototype.await=function(e,t,r){if(n(this.isRoot),t in this.resolvedRefs){var i=this.resolvedRefs[t].filter(function(t){return u(t.modelSchema,e)})[0];if(i)return void r(null,i.value)}this.pendingRefsCount++,this.pendingRefs[t]||(this.pendingRefs[t]=[]),this.pendingRefs[t].push({modelSchema:e,uuid:t,callback:r})},w.prototype.resolve=function(e,t,r){if(n(this.isRoot),this.resolvedRefs[t]||(this.resolvedRefs[t]=[]),this.resolvedRefs[t].push({modelSchema:e,value:r}),t in this.pendingRefs)for(var i=this.pendingRefs[t].length-1;i>=0;i--){var o=this.pendingRefs[t][i];u(e,o.modelSchema)&&(this.pendingRefs[t].splice(i,1),this.pendingRefsCount--,o.callback(null,r))}},w.prototype.setTarget=function(e){this.isRoot&&this.target&&S["delete"](this.target),this.target=e,S.set(this.target,this)},w.prototype.cancelAwaits=function(){n(this.isRoot);var e=this;Object.keys(this.pendingRefs).forEach(function(t){e.pendingRefs[t].forEach(function(n){e.pendingRefsCount--,n.callback(new Error("Reference resolution canceled for "+t))})}),this.pendingRefs={},this.pendingRefsCount=0},e.createSimpleSchema=function(e){return{factory:function(){return{}},props:e}},e.createModelSchema=y,e.getDefaultModelSchema=d,e.setDefaultModelSchema=h,e.serializable=function(e,t,r){if(1===arguments.length){var i=!0===e?b:e;return n(s(i),"@serializable expects prop schema"),j.bind(null,i)}return j(m(),e,t,r)},e.serialize=x,e.serializeAll=function(e,t){let r,i=!1;function o(e){var t=d(e);return t&&e.hasOwnProperty("serializeInfo")||h(e,t=y(e,{})),d(e).props["*"]=r,e}return 1===arguments.length?(n("function"==typeof e,"@serializeAll can only be used as class decorator"),r=!0,i=!0):(n("object"==typeof e&&e.test,"@serializeAll pattern doesn't have test"),"function"==typeof t&&(t=I(t)),n("object"==typeof t&&t.serializer,"couldn't resolve schema"),r=Object.assign({},t,{pattern:e})),i?o(e):o},e.cancelDeserialize=function(e){n("object"==typeof e&&e&&!Array.isArray(e),"cancelDeserialize needs an object");var t,r=(t=e,S.get(t));r&&r.cancelAwaits()},e.deserialize=function(e,t,o,s){if(n(arguments.length>=2,"deserialize expects at least 2 arguments"),n(a(e=d(e)),"first argument should be model schema"),Array.isArray(t)){var f=[];return i(t,function(t,n){var r=A(null,e,t,n,s);f.push(r)},o||r),f}return A(null,e,t,o,s)},e.update=function(e,t,i,o,s){2===arguments.length||"function"==typeof arguments[2]?(e=d(t=arguments[0]),i=arguments[1],o=arguments[2],s=arguments[3]):e=d(e),n(a(e),"update failed to determine schema"),n("object"==typeof t&&t&&!Array.isArray(t),"update needs an object");var f=new w(null,e,i,o,s);f.setTarget(t);var c=f.createCallback(r),u=O(f,e,i,t);return c(),u},e.primitive=m,e.identifier=function(e,t){var r,i;"function"==typeof e?(r=e,i=t):i=e,n(!i||"object"==typeof i,"Additional property arguments should be an object, register function should be omitted or a funtion");var o={identifier:!0,serializer:b.serializer,deserializer:function(e,t,n){b.deserializer(e,function(e,i){!function(e,t,n){n.rootContext.resolve(n.modelSchema,e,n.target)}(i,n.target,n),r&&r(i,n.target,n),t(e,i)})}};return o=p(o,i)},e.date=function(e){var t={serializer:function(e){return null===e||e===undefined?e:(n(e instanceof Date,"Expected Date object"),e.getTime())},deserializer:function(e,t){null!==e&&e!==undefined?t(null,new Date(e)):t(null,e)}};return t=p(t,e)},e.alias=function(e,t){return n(e&&"string"==typeof e,"expected prop name as first argument"),n(s(t=t&&!0!==t?t:b),"expected prop schema as second argument"),n(!f(t),"provided prop is already aliased"),{jsonname:e,serializer:t.serializer,deserializer:t.deserializer,identifier:c(t),beforeDeserialize:t.beforeDeserialize,afterDeserialize:t.afterDeserialize}},e.custom=function(e,t,r){n("function"==typeof e,"first argument should be function"),n("function"==typeof t,"second argument should be a function or promise");var i={serializer:e,deserializer:function(e,n,i,o){4===t.length?t(e,i,o,n,r):n(null,t(e,i,o,null,r))}};return i=p(i,r)},e.object=I,e.child=I,e.optional=function(e,t){n(s(t=t&&!0!==t?t:b),"expected prop schema as second argument");const r=t.serializer;return n("function"==typeof r,"expected prop schema to have a callable serializer"),Object.assign({},t,{serializer:function(...e){const t=r(...e);return t===undefined?g:t}})},e.reference=N,e.ref=N,e.list=P,e.map=function(e,t){n(s(e=e||b),"expected prop schema as first argument"),n(!f(e),"provided prop is aliased, please put aliases first");var r={serializer:function(t){n(t&&"object"==typeof t,"expected object or Map");var r=l(t),i={};if(r)t.forEach(function(t,n){i[n]=e.serializer(t)});else for(var o in t)i[o]=e.serializer(t[o]);return i},deserializer:function(n,r,i,o){if(n&&"object"==typeof n){var a=Object.keys(n);P(e,t).deserializer(a.map(function(e){return n[e]}),function(e,t){if(e)r(e);else{var n,i=l(o);i?(o.clear(),n=o):n={};for(var s=0,f=a.length;s<f;s++)i?n.set(a[s],t[s]):n[a[s]]=t[s];r(null,n)}},i)}else r("[serializr] expected JSON object")}};return r=p(r,t)},e.mapAsArray=function(e,t,r){n(s(e=e||b),"expected prop schema as first argument"),n(!!t,"expected key property name as second argument");var i={serializer:function(t){n(t&&"object"==typeof t,"expected object or Map");var r=l(t),i=[];if(r)t.forEach(function(t){i.push(e.serializer(t))});else for(var o in t)i.push(e.serializer(t[o]));return i},deserializer:function(n,i,o,a){P(e,r).deserializer(n,function(e,r){if(e)i(e);else{var o,s=l(a);s?(a.clear(),o=a):o={};for(var f=0,c=n.length;f<c;f++)s?o.set(r[f][t],r[f]):o[r[f][t].toString()]=r[f];i(null,o)}},o)}};return i=p(i,r)},e.raw=function(e){var t={serializer:function(e){return e},deserializer:function(e,t){t(null,e)}};return t=p(t,e)},e.SKIP=g,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=serializr.min.js.map |
{ | ||
"name": "serializr", | ||
"version": "1.5.3", | ||
"version": "1.5.4", | ||
"description": "Serialize and deserialize complex object graphs to JSON", | ||
@@ -5,0 +5,0 @@ "main": "lib/serializr.js", |
@@ -418,3 +418,3 @@ # Serializr | ||
[src/serializr.js:52-52](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/serializr.js#L5-L51 "Source code on GitHub") | ||
[src/serializr.js:52-52](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/serializr.js#L5-L51 "Source code on GitHub") | ||
@@ -465,3 +465,3 @@ JSDOC type defintions for usage w/o typescript. | ||
[src/api/createSimpleSchema.js:17-24](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/api/createSimpleSchema.js#L17-L24 "Source code on GitHub") | ||
[src/api/createSimpleSchema.js:17-24](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/api/createSimpleSchema.js#L17-L24 "Source code on GitHub") | ||
@@ -491,3 +491,3 @@ Creates a model schema that (de)serializes from / to plain javascript objects. | ||
[src/api/createModelSchema.js:29-47](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/api/createModelSchema.js#L29-L47 "Source code on GitHub") | ||
[src/api/createModelSchema.js:29-47](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/api/createModelSchema.js#L29-L47 "Source code on GitHub") | ||
@@ -525,3 +525,3 @@ Creates a model schema that (de)serializes an object created by a constructor function (class). | ||
[src/api/getDefaultModelSchema.js:9-18](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/api/getDefaultModelSchema.js#L9-L18 "Source code on GitHub") | ||
[src/api/getDefaultModelSchema.js:9-18](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/api/getDefaultModelSchema.js#L9-L18 "Source code on GitHub") | ||
@@ -538,3 +538,3 @@ Returns the standard model schema associated with a class / constructor function | ||
[src/api/setDefaultModelSchema.js:15-18](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/api/setDefaultModelSchema.js#L15-L18 "Source code on GitHub") | ||
[src/api/setDefaultModelSchema.js:15-18](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/api/setDefaultModelSchema.js#L15-L18 "Source code on GitHub") | ||
@@ -557,3 +557,3 @@ Sets the default model schema for class / constructor function. | ||
[src/api/serializable.js:93-103](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/api/serializable.js#L93-L103 "Source code on GitHub") | ||
[src/api/serializable.js:93-103](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/api/serializable.js#L93-L103 "Source code on GitHub") | ||
@@ -582,3 +582,3 @@ Decorator that defines a new property mapping on the default model schema for the class | ||
[src/core/serialize.js:14-36](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/core/serialize.js#L14-L36 "Source code on GitHub") | ||
[src/core/serialize.js:14-36](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/core/serialize.js#L14-L36 "Source code on GitHub") | ||
@@ -598,3 +598,3 @@ Serializes an object (graph) into json using the provided model schema. | ||
[src/core/serializeAll.js:38-67](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/core/serializeAll.js#L38-L67 "Source code on GitHub") | ||
[src/core/serializeAll.js:38-67](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/core/serializeAll.js#L38-L67 "Source code on GitHub") | ||
@@ -617,3 +617,3 @@ The `serializeAll` decorator can may used on a class to signal that all primitive properties, | ||
[src/core/cancelDeserialize.js:12-18](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/core/cancelDeserialize.js#L12-L18 "Source code on GitHub") | ||
[src/core/cancelDeserialize.js:12-18](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/core/cancelDeserialize.js#L12-L18 "Source code on GitHub") | ||
@@ -628,3 +628,3 @@ Cancels an asynchronous deserialization or update operation for the specified target object. | ||
[src/core/deserialize.js:69-87](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/core/deserialize.js#L69-L87 "Source code on GitHub") | ||
[src/core/deserialize.js:69-87](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/core/deserialize.js#L69-L87 "Source code on GitHub") | ||
@@ -652,3 +652,3 @@ Deserializes a json structure into an object graph. | ||
[src/core/update.js:22-44](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/core/update.js#L22-L44 "Source code on GitHub") | ||
[src/core/update.js:22-44](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/core/update.js#L22-L44 "Source code on GitHub") | ||
@@ -671,3 +671,3 @@ Similar to deserialize, but updates an existing object instance. | ||
[src/types/primitive.js:18-32](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/types/primitive.js#L18-L32 "Source code on GitHub") | ||
[src/types/primitive.js:18-32](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/types/primitive.js#L18-L32 "Source code on GitHub") | ||
@@ -695,3 +695,3 @@ Indicates that this field contains a primitive value (or Date) which should be serialized literally to json. | ||
[src/types/identifier.js:43-66](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/types/identifier.js#L43-L66 "Source code on GitHub") | ||
[src/types/identifier.js:43-66](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/types/identifier.js#L43-L66 "Source code on GitHub") | ||
@@ -737,3 +737,3 @@ Similar to primitive, but this field will be marked as the identifier for the given Model type. | ||
[src/types/date.js:9-26](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/types/date.js#L9-L26 "Source code on GitHub") | ||
[src/types/date.js:9-26](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/types/date.js#L9-L26 "Source code on GitHub") | ||
@@ -750,3 +750,3 @@ Similar to primitive, serializes instances of Date objects | ||
[src/types/alias.js:20-33](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/types/alias.js#L20-L33 "Source code on GitHub") | ||
[src/types/alias.js:20-33](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/types/alias.js#L20-L33 "Source code on GitHub") | ||
@@ -776,3 +776,3 @@ Alias indicates that this model property should be named differently in the generated json. | ||
[src/types/custom.js:60-75](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/types/custom.js#L60-L75 "Source code on GitHub") | ||
[src/types/custom.js:60-75](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/types/custom.js#L60-L75 "Source code on GitHub") | ||
@@ -842,3 +842,3 @@ Can be used to create simple custom propSchema. Multiple things can be done inside of a custom propSchema, like deserializing and serializing other (polymorphic) objects, skipping the serialization of something or checking the context of the obj being (de)serialized. | ||
[src/types/object.js:35-55](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/types/object.js#L35-L55 "Source code on GitHub") | ||
[src/types/object.js:35-55](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/types/object.js#L35-L55 "Source code on GitHub") | ||
@@ -881,3 +881,3 @@ `object` indicates that this property contains an object that needs to be (de)serialized | ||
[src/types/optional.js:18-31](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/types/optional.js#L18-L31 "Source code on GitHub") | ||
[src/types/optional.js:18-31](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/types/optional.js#L18-L31 "Source code on GitHub") | ||
@@ -906,3 +906,3 @@ Optional indicates that this model property shouldn't be serialized if it isn't present. | ||
[src/types/reference.js:66-105](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/types/reference.js#L66-L105 "Source code on GitHub") | ||
[src/types/reference.js:66-105](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/types/reference.js#L66-L105 "Source code on GitHub") | ||
@@ -972,3 +972,3 @@ `reference` can be used to (de)serialize references that point to other models. | ||
[src/types/list.js:43-105](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/types/list.js#L43-L105 "Source code on GitHub") | ||
[src/types/list.js:43-105](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/types/list.js#L43-L105 "Source code on GitHub") | ||
@@ -1012,3 +1012,3 @@ List indicates that this property contains a list of things. | ||
[src/types/map.js:14-65](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/types/map.js#L14-L65 "Source code on GitHub") | ||
[src/types/map.js:14-65](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/types/map.js#L14-L65 "Source code on GitHub") | ||
@@ -1028,3 +1028,3 @@ Similar to list, but map represents a string keyed dynamic collection. | ||
[src/types/mapAsArray.js:19-66](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/types/mapAsArray.js#L19-L66 "Source code on GitHub") | ||
[src/types/mapAsArray.js:19-66](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/types/mapAsArray.js#L19-L66 "Source code on GitHub") | ||
@@ -1049,3 +1049,3 @@ Similar to map, mapAsArray can be used to serialize a map-like collection where the key is | ||
[src/types/raw.js:18-29](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/types/raw.js#L18-L29 "Source code on GitHub") | ||
[src/types/raw.js:18-29](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/types/raw.js#L18-L29 "Source code on GitHub") | ||
@@ -1074,3 +1074,3 @@ Indicates that this field is only need to putted in the serialized json or | ||
[src/constants.js:20-20](https://git@github.com/:mobxjs/serializr/blob/6d21f2cf33d728b8991d2f70409323137837894b/src/constants.js#L20-L20 "Source code on GitHub") | ||
[src/constants.js:20-20](https://git@github.com/:mobxjs/serializr/blob/caa3000e9ec548fb2d63ea045cc9fdaef38454b2/src/constants.js#L20-L20 "Source code on GitHub") | ||
@@ -1077,0 +1077,0 @@ In the event that a property needs to be deserialized, but not serialized, you can use the SKIP symbol to omit the property. This has to be used with the custom serializer. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
274645
0