Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

imvvm

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imvvm - npm Package Compare versions

Comparing version 0.6.5 to 0.6.6

2

bower.json
{
"name": "imvvm",
"version": "0.6.5",
"version": "0.6.6",
"homepage": "https://github.com/entrendipity/imvvm",

@@ -5,0 +5,0 @@ "authors": [

@@ -337,2 +337,3 @@ !function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.IMVVM=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){

autoFreeze = [],
aliases = {},
key;

@@ -349,2 +350,7 @@

this.originalSpec[key].enumerable = true;
if('aliasFor' in this.originalSpec[key]){
aliases[this.originalSpec[key].aliasFor] = key;
delete this.originalSpec[key].aliasFor;
}
if('viewModel' in this.originalSpec[key]) {

@@ -383,3 +389,4 @@ viewModels[key] = this.originalSpec[key].viewModel;

originalSpec: this.originalSpec || {},
freezeFields: autoFreeze
freezeFields: autoFreeze,
aliases: aliases
};

@@ -506,2 +513,8 @@

if(initialize && ('getInitialState' in model)){
for(var aliasFor in desc.aliases){
if(desc.aliases.hasOwnProperty(aliasFor)){
nextState[desc.aliases[aliasFor]] = nextState[aliasFor];
delete nextState[aliasFor];
}
}
nextState = extend(nextState, model.getInitialState.call(model));

@@ -508,0 +521,0 @@ }

@@ -1,1 +0,1 @@

!function(b){if("object"==typeof exports){module.exports=b()}else{if("function"==typeof define&&define.amd){define(b)}else{var a;"undefined"!=typeof window?a=window:"undefined"!=typeof global?a=global:"undefined"!=typeof self&&(a=self),a.IMVVM=b()}}}(function(){var d,b,a;return(function c(f,k,h){function g(n,l){if(!k[n]){if(!f[n]){var i=typeof require=="function"&&require;if(!l&&i){return i(n,!0)}if(e){return e(n,!0)}throw new Error("Cannot find module '"+n+"'")}var m=k[n]={exports:{}};f[n][0].call(m.exports,function(o){var p=f[n][1][o];return g(p?p:o)},m,m.exports,c,f,k,h)}return k[n].exports}var e=typeof require=="function"&&require;for(var j=0;j<h.length;j++){g(h[j])}return g})({1:[function(h,g,f){var e=h("./src/imvvm.js");g.exports=e},{"./src/imvvm.js":3}],2:[function(h,g,f){var e=h("./utils");var i=e.extend;f.getInitialState=function(l,m,v,k){if(typeof v!=="function"){throw new TypeError()}k===void (0)?true:k;var A,u={},r={},B,j={},y={},t,q={},o={},x,w,z,s,p;var n=function(E,I,K,P){var R={},N={},L,G,F,D,H,J=[],O,M,C,Q;if(typeof K==="function"){P=K;K={}}I=I||{};L=Object.keys(I);if(Object.getPrototypeOf(I).constructor.classType==="DomainViewModel"){R=i(I);N=I.previousState;for(D in B){R[D]=new r[D](R)}for(D in B){if(B.hasOwnProperty(D)){for(H in j[D]){if(j[D].hasOwnProperty(H)){R[D].state[j[D][H]]=(H in B)?i(R[H].state):R[H]}}}}}else{if(!!L.length){if(E===l){R=i(I)}else{R[E]=i(I)}}q=i(R,q,K);transientStateKeys=Object.keys(q);if(transientStateKeys.length===0){return}if(typeof P==="function"){P();return}F=transientStateKeys.length-1;for(G=F;G>=0;G--){if(transientStateKeys[G] in B){R[transientStateKeys[G]]=i(u[transientStateKeys[G]],q[transientStateKeys[G]]);R[transientStateKeys[G]]=new r[transientStateKeys[G]](R)}else{R[transientStateKeys[G]]=q[transientStateKeys[G]]}}o=i(o,R);R=i(u,o);q={};for(G=F;G>=0;G--){if(transientStateKeys[G] in y){for(M in y[transientStateKeys[G]]){if(y[transientStateKeys[G]].hasOwnProperty(M)){if(L.indexOf(M)!==-1){C=y[transientStateKeys[G]][M];for(Q in C){if(C.hasOwnProperty(Q)){q=i(q,C[Q].call(u[Q],R[transientStateKeys[G]][M],u[transientStateKeys[G]][M],M,transientStateKeys[G]))}}}}}}}if(!!Object.keys(q).length){n(void (0),{},q);return}J=Object.keys(o);O=J.length-1;for(G=O;G>=0;G--){if(E===l){if(J[G] in j[l]){for(D in j[l][J[G]]){if(j[l][J[G]].hasOwnProperty(D)){R[D].state[j[l][J[G]][D]]=R[J[G]]}if(D in j){for(dataContext2 in j[D]){if(j[D].hasOwnProperty(dataContext2)){R[D].state[j[D][dataContext2]]=(dataContext2 in B)?i(R[dataContext2].state):R[dataContext2]}}}}}}else{if(J[G] in j){for(D in j[J[G]]){if(j[J[G]].hasOwnProperty(D)){R[J[G]].state[j[J[G]][D]]=(D in B)?i(R[D].state):R[D]}if(D in j){for(dataContext2 in j[D]){if(j[D].hasOwnProperty(dataContext2)){R[D].state[j[D][dataContext2]]=(dataContext2 in B)?i(R[dataContext2].state):R[dataContext2]}}}}}}}N=u}if(!!N){Object.freeze(N)}u=new A(R,N,k);Object.freeze(u);Object.freeze(u.state);v(u);q={};o={};return u};A=m.call(this,n.bind(this,l));u=new A(void (0),void (0),k,true);u.state=u.state||{};B=u.getDomainDataContext();for(t in B){if(B.hasOwnProperty(t)){r[t]=B[t].call(this,n.bind(this,t)).bind(this,t);u.state[t]=new r[t](u.state);if("getWatchedState" in u[t]){x=u[t].getWatchedState();for(w in x){if(x.hasOwnProperty(w)){if(w in B||w in u.state){if("alias" in x[w]){if(!(t in j)){j[t]={}}j[t][w]=x[w].alias;if(!(w in B)){if(!(l in j)){j[l]={}}if(!(t in j[l])){j[l][w]={}}j[l][w][t]=x[w].alias}}for(z in x[w].fields){if(x[w].fields.hasOwnProperty(z)){if(w in B){s={};if(!(w in y)){y[w]={}}s[z]={};s[z][t]=x[w].fields[z];y[w]=s}}}}}}}}}for(t in B){if(B.hasOwnProperty(t)){for(p in j[t]){if(j[t].hasOwnProperty(p)){u[t].state[j[t][p]]=(p in B)?i(u[p].state):u[p]}}}}u=new A(u,void (0),k);Object.freeze(u.state);Object.freeze(u);return u}},{"./utils":8}],3:[function(f,g,j){var k=f("./imvvmModel");var p=f("./imvvmViewModel");var i=f("./imvvmDomainViewModel");var r=f("./mixin");var q=f("./utils");var o=q.extend;var m=q.mixInto;var l=function(){};var h=function(){};var n=function(){};m(l,k.Mixin);m(h,p.Mixin);m(n,i.Mixin);var e={createClass:function(u,v,t){var y=function(){};y.prototype=new u();y.prototype.constructor=y;var x=y;var w=function(z){var A=new x();return A.construct.apply(w,arguments)};w.componentConstructor=y;y.ConvenienceConstructor=w;w.originalSpec=t;w.type=y;y.prototype.type=y;w.classType=v;y.prototype.classType=v;w.getDescriptor=function(){var D={},C=this.prototype,A={},z=[],B;if("__processedObject__" in this.originalSpec){return this.originalSpec.__processedObject__}for(B in this.originalSpec){if(this.originalSpec.hasOwnProperty(B)){if("get" in this.originalSpec[B]||"set" in this.originalSpec[B]){this.originalSpec[B].enumerable=true;if("viewModel" in this.originalSpec[B]){A[B]=this.originalSpec[B].viewModel;delete this.originalSpec[B].viewModel;delete this.originalSpec[B].set}else{if("kind" in this.originalSpec[B]){if(this.originalSpec[B].kind==="pseudo"){this.originalSpec[B].enumerable=false}else{z.push({fieldName:B,kind:this.originalSpec[B].kind})}delete this.originalSpec[B].kind}}D[B]=this.originalSpec[B]}else{C[B]=this.originalSpec[B]}}}if(!("extend" in C)){C.extend=q.extend}if(!!Object.keys(A).length){C.getDomainDataContext=function(){return A}}this.originalSpec.__processedObject__={descriptor:D,proto:C,originalSpec:this.originalSpec||{},freezeFields:z};return this.originalSpec.__processedObject__};return w}};var s={createModel:e.createClass.bind(this,l,"Model"),createViewModel:e.createClass.bind(this,h,"ViewModel"),createDomainViewModel:e.createClass.bind(this,n,"DomainViewModel"),mixin:r};g.exports=s},{"./imvvmDomainViewModel":4,"./imvvmModel":5,"./imvvmViewModel":6,"./mixin":7,"./utils":8}],4:[function(j,h,f){var e=j("./utils");var k=e.extend;var g=e.getDescriptor;var i={Mixin:{construct:function(m){var n=this.getDescriptor(this);n.proto.setState=m;var l=function(q,u,t,o){var s=n.freezeFields,r=Object.create(n.proto,n.descriptor),p;if(!!t&&!!u){Object.defineProperty(r,"previousState",{configurable:false,enumerable:false,writable:false,value:u})}if(q===void (0)&&("getInitialState" in r)){q=r.getInitialState.call(r)}else{if("state" in q){delete q.state;Object.defineProperty(r,"state",{configurable:true,enumerable:false,writable:true,value:q});q=k(q,r)}}Object.defineProperty(r,"state",{configurable:false,enumerable:false,writable:false,value:q});for(p=s.length-1;p>=0;p--){Object.freeze(r[s[p].fieldName])}return r};return l}}};h.exports=i},{"./utils":8}],5:[function(i,h,f){var e=i("./utils");var k=e.extend;var g=e.getDescriptor;var j={Mixin:{construct:function(m){var n=this.getDescriptor(this);n.stateChangedHandler=m;n.proto.__getDescriptor=function(){return n};var l=function(r,o){var s=n.freezeFields,q,p=Object.create(n.proto,n.descriptor);if(r===void (0)){o=true}r=r||{};Object.defineProperty(p,"state",{configurable:true,enumerable:false,writable:true,value:r});r=k(r,p);if(o&&("getInitialState" in p)){r=k(r,p.getInitialState.call(p))}Object.defineProperty(p,"state",{configurable:false,enumerable:false,writable:false,value:r});for(q=s.length-1;q>=0;q--){Object.freeze(p[s[q].fieldName])}return Object.freeze(p)};return l}}};h.exports=j},{"./utils":8}],6:[function(j,i,g){var f=j("./utils");var k=f.extend;var h=f.getDescriptor;var e={Mixin:{construct:function(m){var n=this.getDescriptor(this);n.proto.setState=m;var l=function(t,q){var s={},u=n.freezeFields,r,p=Object.create(n.proto,n.descriptor),v,o;Object.defineProperty(p,"state",{configurable:true,enumerable:false,writable:true,value:s});if(q[t]===void (0)){if("getInitialState" in p){s=k(s,p.getInitialState.call(p))}}else{s=("state" in q[t]?q[t].state:q[t])}Object.defineProperty(p,"state",{configurable:false,enumerable:false,writable:false,value:s});for(r=u.length-1;r>=0;r--){if(u[r].kind==="instance"){if(p[u[r].fieldName]){v=p[u[r].fieldName].__getDescriptor();o=Object.create(v.proto,v.descriptor);Object.defineProperty(o,"state",{configurable:false,enumerable:false,writable:false,value:p[u[r].fieldName].state});o.__proto__.setState=function(w,x){return v.stateChangedHandler.call(this,k(o.state,w),o.state,x)}.bind(p);Object.freeze(p[u[r].fieldName])}}else{Object.freeze(p[u[r].fieldName])}}return Object.freeze(p)};return l}}};i.exports=e},{"./utils":8}],7:[function(j,i,h){var f=j("./core");var e="__IMVVM__";var g={stateChangedHandler:function(k){this.setState({domainDataContext:k})},getInitialState:function(){var k=f.getInitialState(e,this.props.domainModel,this.stateChangedHandler,this.props.enableUndo);return{domainDataContext:k}}};i.exports=g},{"./core":2}],8:[function(h,g,f){var e={extend:function(){var j={};for(var l=0;l<arguments.length;l++){var m=arguments[l];for(var k in m){if(m.hasOwnProperty(k)){j[k]=m[k]}}}return j},mixInto:function(j,k){var i;for(i in k){if(!k.hasOwnProperty(i)){continue}j.prototype[i]=k[i]}}};g.exports=e},{}]},{},[1])(1)});
!function(b){if("object"==typeof exports){module.exports=b()}else{if("function"==typeof define&&define.amd){define(b)}else{var a;"undefined"!=typeof window?a=window:"undefined"!=typeof global?a=global:"undefined"!=typeof self&&(a=self),a.IMVVM=b()}}}(function(){var d,b,a;return(function c(f,k,h){function g(n,l){if(!k[n]){if(!f[n]){var i=typeof require=="function"&&require;if(!l&&i){return i(n,!0)}if(e){return e(n,!0)}throw new Error("Cannot find module '"+n+"'")}var m=k[n]={exports:{}};f[n][0].call(m.exports,function(o){var p=f[n][1][o];return g(p?p:o)},m,m.exports,c,f,k,h)}return k[n].exports}var e=typeof require=="function"&&require;for(var j=0;j<h.length;j++){g(h[j])}return g})({1:[function(h,g,f){var e=h("./src/imvvm.js");g.exports=e},{"./src/imvvm.js":3}],2:[function(h,g,f){var e=h("./utils");var i=e.extend;f.getInitialState=function(l,m,v,k){if(typeof v!=="function"){throw new TypeError()}k===void (0)?true:k;var A,u={},r={},B,j={},y={},t,q={},o={},x,w,z,s,p;var n=function(E,I,K,P){var R={},N={},L,G,F,D,H,J=[],O,M,C,Q;if(typeof K==="function"){P=K;K={}}I=I||{};L=Object.keys(I);if(Object.getPrototypeOf(I).constructor.classType==="DomainViewModel"){R=i(I);N=I.previousState;for(D in B){R[D]=new r[D](R)}for(D in B){if(B.hasOwnProperty(D)){for(H in j[D]){if(j[D].hasOwnProperty(H)){R[D].state[j[D][H]]=(H in B)?i(R[H].state):R[H]}}}}}else{if(!!L.length){if(E===l){R=i(I)}else{R[E]=i(I)}}q=i(R,q,K);transientStateKeys=Object.keys(q);if(transientStateKeys.length===0){return}if(typeof P==="function"){P();return}F=transientStateKeys.length-1;for(G=F;G>=0;G--){if(transientStateKeys[G] in B){R[transientStateKeys[G]]=i(u[transientStateKeys[G]],q[transientStateKeys[G]]);R[transientStateKeys[G]]=new r[transientStateKeys[G]](R)}else{R[transientStateKeys[G]]=q[transientStateKeys[G]]}}o=i(o,R);R=i(u,o);q={};for(G=F;G>=0;G--){if(transientStateKeys[G] in y){for(M in y[transientStateKeys[G]]){if(y[transientStateKeys[G]].hasOwnProperty(M)){if(L.indexOf(M)!==-1){C=y[transientStateKeys[G]][M];for(Q in C){if(C.hasOwnProperty(Q)){q=i(q,C[Q].call(u[Q],R[transientStateKeys[G]][M],u[transientStateKeys[G]][M],M,transientStateKeys[G]))}}}}}}}if(!!Object.keys(q).length){n(void (0),{},q);return}J=Object.keys(o);O=J.length-1;for(G=O;G>=0;G--){if(E===l){if(J[G] in j[l]){for(D in j[l][J[G]]){if(j[l][J[G]].hasOwnProperty(D)){R[D].state[j[l][J[G]][D]]=R[J[G]]}if(D in j){for(dataContext2 in j[D]){if(j[D].hasOwnProperty(dataContext2)){R[D].state[j[D][dataContext2]]=(dataContext2 in B)?i(R[dataContext2].state):R[dataContext2]}}}}}}else{if(J[G] in j){for(D in j[J[G]]){if(j[J[G]].hasOwnProperty(D)){R[J[G]].state[j[J[G]][D]]=(D in B)?i(R[D].state):R[D]}if(D in j){for(dataContext2 in j[D]){if(j[D].hasOwnProperty(dataContext2)){R[D].state[j[D][dataContext2]]=(dataContext2 in B)?i(R[dataContext2].state):R[dataContext2]}}}}}}}N=u}if(!!N){Object.freeze(N)}u=new A(R,N,k);Object.freeze(u);Object.freeze(u.state);v(u);q={};o={};return u};A=m.call(this,n.bind(this,l));u=new A(void (0),void (0),k,true);u.state=u.state||{};B=u.getDomainDataContext();for(t in B){if(B.hasOwnProperty(t)){r[t]=B[t].call(this,n.bind(this,t)).bind(this,t);u.state[t]=new r[t](u.state);if("getWatchedState" in u[t]){x=u[t].getWatchedState();for(w in x){if(x.hasOwnProperty(w)){if(w in B||w in u.state){if("alias" in x[w]){if(!(t in j)){j[t]={}}j[t][w]=x[w].alias;if(!(w in B)){if(!(l in j)){j[l]={}}if(!(t in j[l])){j[l][w]={}}j[l][w][t]=x[w].alias}}for(z in x[w].fields){if(x[w].fields.hasOwnProperty(z)){if(w in B){s={};if(!(w in y)){y[w]={}}s[z]={};s[z][t]=x[w].fields[z];y[w]=s}}}}}}}}}for(t in B){if(B.hasOwnProperty(t)){for(p in j[t]){if(j[t].hasOwnProperty(p)){u[t].state[j[t][p]]=(p in B)?i(u[p].state):u[p]}}}}u=new A(u,void (0),k);Object.freeze(u.state);Object.freeze(u);return u}},{"./utils":8}],3:[function(f,g,j){var k=f("./imvvmModel");var p=f("./imvvmViewModel");var i=f("./imvvmDomainViewModel");var r=f("./mixin");var q=f("./utils");var o=q.extend;var m=q.mixInto;var l=function(){};var h=function(){};var n=function(){};m(l,k.Mixin);m(h,p.Mixin);m(n,i.Mixin);var e={createClass:function(u,v,t){var y=function(){};y.prototype=new u();y.prototype.constructor=y;var x=y;var w=function(z){var A=new x();return A.construct.apply(w,arguments)};w.componentConstructor=y;y.ConvenienceConstructor=w;w.originalSpec=t;w.type=y;y.prototype.type=y;w.classType=v;y.prototype.classType=v;w.getDescriptor=function(){var E={},D=this.prototype,B={},z=[],A={},C;if("__processedObject__" in this.originalSpec){return this.originalSpec.__processedObject__}for(C in this.originalSpec){if(this.originalSpec.hasOwnProperty(C)){if("get" in this.originalSpec[C]||"set" in this.originalSpec[C]){this.originalSpec[C].enumerable=true;if("aliasFor" in this.originalSpec[C]){A[this.originalSpec[C].aliasFor]=C;delete this.originalSpec[C].aliasFor}if("viewModel" in this.originalSpec[C]){B[C]=this.originalSpec[C].viewModel;delete this.originalSpec[C].viewModel;delete this.originalSpec[C].set}else{if("kind" in this.originalSpec[C]){if(this.originalSpec[C].kind==="pseudo"){this.originalSpec[C].enumerable=false}else{z.push({fieldName:C,kind:this.originalSpec[C].kind})}delete this.originalSpec[C].kind}}E[C]=this.originalSpec[C]}else{D[C]=this.originalSpec[C]}}}if(!("extend" in D)){D.extend=q.extend}if(!!Object.keys(B).length){D.getDomainDataContext=function(){return B}}this.originalSpec.__processedObject__={descriptor:E,proto:D,originalSpec:this.originalSpec||{},freezeFields:z,aliases:A};return this.originalSpec.__processedObject__};return w}};var s={createModel:e.createClass.bind(this,l,"Model"),createViewModel:e.createClass.bind(this,h,"ViewModel"),createDomainViewModel:e.createClass.bind(this,n,"DomainViewModel"),mixin:r};g.exports=s},{"./imvvmDomainViewModel":4,"./imvvmModel":5,"./imvvmViewModel":6,"./mixin":7,"./utils":8}],4:[function(j,h,f){var e=j("./utils");var k=e.extend;var g=e.getDescriptor;var i={Mixin:{construct:function(m){var n=this.getDescriptor(this);n.proto.setState=m;var l=function(q,u,t,o){var s=n.freezeFields,r=Object.create(n.proto,n.descriptor),p;if(!!t&&!!u){Object.defineProperty(r,"previousState",{configurable:false,enumerable:false,writable:false,value:u})}if(q===void (0)&&("getInitialState" in r)){q=r.getInitialState.call(r)}else{if("state" in q){delete q.state;Object.defineProperty(r,"state",{configurable:true,enumerable:false,writable:true,value:q});q=k(q,r)}}Object.defineProperty(r,"state",{configurable:false,enumerable:false,writable:false,value:q});for(p=s.length-1;p>=0;p--){Object.freeze(r[s[p].fieldName])}return r};return l}}};h.exports=i},{"./utils":8}],5:[function(i,h,f){var e=i("./utils");var k=e.extend;var g=e.getDescriptor;var j={Mixin:{construct:function(m){var n=this.getDescriptor(this);n.stateChangedHandler=m;n.proto.__getDescriptor=function(){return n};var l=function(r,o){var s=n.freezeFields,q,p=Object.create(n.proto,n.descriptor);if(r===void (0)){o=true}r=r||{};Object.defineProperty(p,"state",{configurable:true,enumerable:false,writable:true,value:r});r=k(r,p);if(o&&("getInitialState" in p)){for(var t in n.aliases){if(n.aliases.hasOwnProperty(t)){r[n.aliases[t]]=r[t];delete r[t]}}r=k(r,p.getInitialState.call(p))}Object.defineProperty(p,"state",{configurable:false,enumerable:false,writable:false,value:r});for(q=s.length-1;q>=0;q--){Object.freeze(p[s[q].fieldName])}return Object.freeze(p)};return l}}};h.exports=j},{"./utils":8}],6:[function(j,i,g){var f=j("./utils");var k=f.extend;var h=f.getDescriptor;var e={Mixin:{construct:function(m){var n=this.getDescriptor(this);n.proto.setState=m;var l=function(t,q){var s={},u=n.freezeFields,r,p=Object.create(n.proto,n.descriptor),v,o;Object.defineProperty(p,"state",{configurable:true,enumerable:false,writable:true,value:s});if(q[t]===void (0)){if("getInitialState" in p){s=k(s,p.getInitialState.call(p))}}else{s=("state" in q[t]?q[t].state:q[t])}Object.defineProperty(p,"state",{configurable:false,enumerable:false,writable:false,value:s});for(r=u.length-1;r>=0;r--){if(u[r].kind==="instance"){if(p[u[r].fieldName]){v=p[u[r].fieldName].__getDescriptor();o=Object.create(v.proto,v.descriptor);Object.defineProperty(o,"state",{configurable:false,enumerable:false,writable:false,value:p[u[r].fieldName].state});o.__proto__.setState=function(w,x){return v.stateChangedHandler.call(this,k(o.state,w),o.state,x)}.bind(p);Object.freeze(p[u[r].fieldName])}}else{Object.freeze(p[u[r].fieldName])}}return Object.freeze(p)};return l}}};i.exports=e},{"./utils":8}],7:[function(j,i,h){var f=j("./core");var e="__IMVVM__";var g={stateChangedHandler:function(k){this.setState({domainDataContext:k})},getInitialState:function(){var k=f.getInitialState(e,this.props.domainModel,this.stateChangedHandler,this.props.enableUndo);return{domainDataContext:k}}};i.exports=g},{"./core":2}],8:[function(h,g,f){var e={extend:function(){var j={};for(var l=0;l<arguments.length;l++){var m=arguments[l];for(var k in m){if(m.hasOwnProperty(k)){j[k]=m[k]}}}return j},mixInto:function(j,k){var i;for(i in k){if(!k.hasOwnProperty(i)){continue}j.prototype[i]=k[i]}}};g.exports=e},{}]},{},[1])(1)});

@@ -76,2 +76,3 @@ /*jshint unused: false */

occupation: {
aliasFor: "job",
get: function(){

@@ -78,0 +79,0 @@ return this.state.occupation;

@@ -5,5 +5,5 @@ 'use strict';

getPersonData: function() {
return [{id:'1', firstName:'Frank', lastName: "Smith", gender:'male', dob:'1980-03-03', occupation:'dentist', hobbies: ['reading', 'golfing', 'computer programming']},
{id:'2', firstName:'Lisa', lastName: "Jones", gender:'female', dob:'1985-02-22', occupation:'accountant', hobbies: ['reading']},
{id:'3', firstName: "John", lastName: "Citizen", gender:'male', dob:'1975-12-11', occupation:'unemployed', hobbies: ['watching TV']}];
return [{id:'1', firstName:'Frank', lastName: "Smith", gender:'male', dob:'1980-03-03', job:'dentist', hobbies: ['reading', 'golfing', 'computer programming']},
{id:'2', firstName:'Lisa', lastName: "Jones", gender:'female', dob:'1985-02-22', job:'accountant', hobbies: ['reading']},
{id:'3', firstName: "John", lastName: "Citizen", gender:'male', dob:'1975-12-11', job:'unemployed', hobbies: ['watching TV']}];
},

@@ -10,0 +10,0 @@ getHobbiesData: function(uid) {

{
"name": "imvvm",
"description": "Immutable MVVM for React",
"version": "0.6.5",
"version": "0.6.6",
"keywords": [

@@ -6,0 +6,0 @@ "imvvm",

@@ -470,5 +470,2 @@ IMVVM

},
updateDOB: function(e){
this.props.appContext.persons.selectedPerson.dob = e.target.value;
},
render: function() {

@@ -810,2 +807,24 @@ var current = this.props.appContext.persons.selectedPerson;

######aliasFor: string originalKey
**aliasFor**
Transforms key from original data source to specified field.
__example__
In original data source, key was referenced a `job`, but model will expose it a `occupation`. This is a one way transformation. If it is required to persist the data as `job`, that will need to be done within the application.
```javascript
occupation: {
aliasFor: "job",
get: function(){
return this.state.occupation;
},
set: function(newValue){
this.setState({'occupation': newValue });
}
},
```
_Available in:_ Model
######viewModel: ViewModel Class

@@ -812,0 +831,0 @@ **viewModel**

@@ -54,2 +54,3 @@

autoFreeze = [],
aliases = {},
key;

@@ -66,2 +67,7 @@

this.originalSpec[key].enumerable = true;
if('aliasFor' in this.originalSpec[key]){
aliases[this.originalSpec[key].aliasFor] = key;
delete this.originalSpec[key].aliasFor;
}
if('viewModel' in this.originalSpec[key]) {

@@ -100,3 +106,4 @@ viewModels[key] = this.originalSpec[key].viewModel;

originalSpec: this.originalSpec || {},
freezeFields: autoFreeze
freezeFields: autoFreeze,
aliases: aliases
};

@@ -103,0 +110,0 @@

@@ -37,2 +37,8 @@

if(initialize && ('getInitialState' in model)){
for(var aliasFor in desc.aliases){
if(desc.aliases.hasOwnProperty(aliasFor)){
nextState[desc.aliases[aliasFor]] = nextState[aliasFor];
delete nextState[aliasFor];
}
}
nextState = extend(nextState, model.getInitialState.call(model));

@@ -39,0 +45,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc