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.2.0-alpha to 0.2.1-alpha

2

bower.json
{
"name": "imvvm",
"version": "0.2.0-alpha",
"version": "0.2.1-alpha",
"homepage": "https://github.com/entrendipity/imvvm",

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

@@ -148,2 +148,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){

appContext = thisAppState.state;
if(!initialize && !disableUndo){

@@ -288,3 +289,3 @@ appContext.previousState = thisAppState.previousState;

if(desc.originalSpec.getInitialState){ //NEED to check -vv
if(desc.originalSpec.getInitialState){
nextState = extend(nextState, desc.originalSpec.getInitialState.call(model, nextState, previousState));

@@ -335,3 +336,8 @@ }

if(argCount === 1){
if(argCount === 0){
//defaults
nextState = {};
prevState = {};
withContext = true;
} else if(argCount === 1){
if(lastIsBoolean){

@@ -342,19 +348,15 @@ withContext = nextState;

} else {
//assume prevState is same as nextState
prevState = nextState;
withContext = true;
}
} else if(argCount === 2 && lastIsBoolean){
if(lastIsBoolean){
withContext = prevState;
prevState = {};
} else {
nextState = extend(prevState, nextState);
}
} else if(argCount === 3){
nextState = extend(prevState, nextState);
} else {
//defaults
nextState = {};
prevState = {};
withContext = true;
} else if(argCount === 2){
if(lastIsBoolean){
withContext = prevState;
prevState = nextState;
} else {
withContext = true;
}
}
//Initialize any props

@@ -448,2 +450,3 @@ if(desc.originalSpec.getInitialState){

//TODO - rework this, as __proto__ is deprecated
nextState.__proto__ = model.__proto__;

@@ -450,0 +453,0 @@ return Object.freeze(nextState);

@@ -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,q,j,r,u,y){if(typeof u!=="function"){throw new TypeError()}var w={},k={},v,o={};y===void (0)?false:y;var p=function(B,F,D){var G=false,E,A;F=F||{};if(B===void (0)){A=true;B={}}var C=function(I){var K={},J,H;if("dependsOn" in I){I.dependsOn.forEach(function(L){H={};J=L.property.split(".");J.forEach(function(N,M){if(M===0){H=B[N]}else{H=H?H[N]:void (0)}});if("alias" in L){K[L.alias]=H}else{K[J.join("$")]=H}})}return K};for(var z in r){if(r.hasOwnProperty(z)){E=C(r[z]);if(A){B[z]=new k[z](B[z],E,F[z]).init(r[z].initArgs)}else{B[z]=new k[z](B[z],E,F[z])}if(D){if(G&&D.subscribers.indexOf(z)!==-1){E=C(r[D.name]);B[D.name]=new k[D.name](B[D.name],E,F[D.name])}G=G?G:z===D.name}}}return B};var n=function(z,A,I,E){var H={},L={},G={},K=void (0),F,D,J;E===void (0)?false:E;if(!E&&(A===void (0)||A===null||Object.keys(A).length===0)){return}var C=!!A?Object.getPrototypeOf(A).constructor.classType==="DomainModel":false;if(C){L=i(A);G=A.previousState}else{if(z in o){F=Object.keys(A);D=F.length;J={};for(var B=0;B<D;B++){if(o[z][F[B]]){J[o[z][F[B]]]=true}}K={};K.name=z;K.subscribers=Object.keys(J);K=!!K.subscribers.length?K:void (0)}if(z!==l){L[z]=A;L=i(w.state,L)}else{if(E){L=i(p(),A)}else{L=i(w.state,A)}}G=w.state;L=p(L,w.state,K)}G=G||{};Object.freeze(G);w=new x(L,G,y,E);H=w.state;if(!E&&!y){H.previousState=w.previousState}Object.freeze(H);u(H,z,I);return H};var x=q.call(this,n.bind(this,l));for(var m in r){if(r.hasOwnProperty(m)){k[m]=r[m].viewModel.call(this,n.bind(this,m));if("dependsOn" in r[m]){for(var s=0,t=r[m].dependsOn.length;s<t;s++){v=r[m].dependsOn[s].property.split(".");if(v.length>1){o[v[0]]=o[v[0]]||{};o[v[0]][v[1]]=o[v[0]][v[1]]||[];if(o[v[0]][v[1]].indexOf(m)===-1){o[v[0]][v[1]].push(m)}}}}}}return new x().init(j)}},{"./utils":8}],3:[function(f,g,j){var k=f("./imvvmModel");var p=f("./imvvmViewModel");var i=f("./imvvmDomainModel");var r=f("./mixin");var q=f("./utils");var n=q.extend;var m=q.mixInto;var l=function(){};var h=function(){};var o=function(){};m(l,k.Mixin);m(h,p.Mixin);m(o,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;return w}};var s={createModel:e.createClass.bind(this,l,"Model"),createViewModel:e.createClass.bind(this,h,"ViewModel"),createDomainModel:e.createClass.bind(this,o,"DomainModel"),mixin:r};g.exports=s},{"./imvvmDomainModel":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=g.call(this);n.proto.setState=m;var l=function(s,q,p,o){s=s||{};q=q||{};if(!("DataContext" in n.proto)){n.proto.DataContext=function(t,u){return n.proto.setState(t,u,true)}}if(!("init" in n.proto)){n.proto.init=function(){return this.DataContext()}}var r=Object.create(n.proto,n.descriptor);if(n.originalSpec.getInitialState){s=k(s,n.originalSpec.getInitialState.call(r,s,q))}if(!o&&!p){Object.defineProperty(r,"previousState",{configurable:false,enumerable:false,writable:false,value:q})}s.__proto__=r.__proto__;Object.defineProperty(r,"state",{configurable:false,enumerable:false,writable:false,value:s});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=g.call(this);var l=function(r,s,o){var q=Object.create(n.proto,n.descriptor);var t=arguments.length;var p=typeof Array.prototype.slice.call(arguments,-1)[0]==="boolean";if(t===1){if(p){o=r;r={};s={}}else{o=true}}else{if(t===2&&p){if(p){o=s;s={}}else{r=k(s,r)}}else{if(t===3){r=k(s,r)}else{r={};s={};o=true}}}if(n.originalSpec.getInitialState){r=k(r,n.originalSpec.getInitialState.call(q,r,s))}if(o){Object.defineProperty(q,"context",{configurable:true,enumerable:true,set:function(u){this.setState=function(v,w){return m.bind(u).call(u,k(this.state,v),this.state,w)}.bind(this);delete this.context}})}Object.defineProperty(q,"state",{configurable:false,enumerable:false,writable:false,value:r});if(!o){Object.freeze(q)}return q};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=h.call(this);n.proto.setState=m;var l=function(p,q,r){r=r||{};p=k(p,q);n.proto.DataContext=l;if(!("init" in n.proto)){n.proto.init=function(){return this.DataContext()}}var o=Object.create(n.proto,n.descriptor);if(n.originalSpec.getInitialState){p=k(p,n.originalSpec.getInitialState.call(o,p,r))}Object.defineProperty(o,"state",{configurable:false,enumerable:false,writable:false,value:p});Object.keys(o).forEach(function(s){if(Object.prototype.toString.call(this[s])==="[object Object]"&&("context" in this[s])){this[s].context=this;Object.freeze(this[s])}if(Object.prototype.toString.call(this[s])==="[object Array]"){Object.freeze(this[s])}}.bind(o));p.__proto__=o.__proto__;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,l,m){this.setState({appContext:k},function(){if(typeof m==="function"){if(this.state===null||!("appContext" in this.state)){m(void (0))}else{if(l in this.state.appContext){m(this.state.appContext[l])}else{if(l===e){m(this.state.appContext)}else{m(void (0))}}}}}.bind(this))},getInitialState:function(){var k=f.getInitialState(e,this.props.domainModel,this.props.initArgs,this.props.domain,this.stateChangedHandler,this.props.disableUndo);return{appContext:k}}};i.exports=g},{"./core":2}],8:[function(h,g,f){var e={getDescriptor:function(){var k={};var j=this.prototype;for(var i in this.originalSpec){if(this.originalSpec.hasOwnProperty(i)){if("get" in this.originalSpec[i]||"set" in this.originalSpec[i]){if(!("enumerable" in this.originalSpec[i])){this.originalSpec[i].enumerable=true}k[i]=this.originalSpec[i]}else{j[i]=this.originalSpec[i]}}}if(!("extend" in j)){j.extend=e.extend}return{descriptor:k,proto:j,originalSpec:this.originalSpec||{}}},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,q,j,r,u,y){if(typeof u!=="function"){throw new TypeError()}var w={},k={},v,o={};y===void (0)?false:y;var p=function(B,F,D){var G=false,E,A;F=F||{};if(B===void (0)){A=true;B={}}var C=function(I){var K={},J,H;if("dependsOn" in I){I.dependsOn.forEach(function(L){H={};J=L.property.split(".");J.forEach(function(N,M){if(M===0){H=B[N]}else{H=H?H[N]:void (0)}});if("alias" in L){K[L.alias]=H}else{K[J.join("$")]=H}})}return K};for(var z in r){if(r.hasOwnProperty(z)){E=C(r[z]);if(A){B[z]=new k[z](B[z],E,F[z]).init(r[z].initArgs)}else{B[z]=new k[z](B[z],E,F[z])}if(D){if(G&&D.subscribers.indexOf(z)!==-1){E=C(r[D.name]);B[D.name]=new k[D.name](B[D.name],E,F[D.name])}G=G?G:z===D.name}}}return B};var n=function(z,A,I,E){var H={},L={},G={},K=void (0),F,D,J;E===void (0)?false:E;if(!E&&(A===void (0)||A===null||Object.keys(A).length===0)){return}var C=!!A?Object.getPrototypeOf(A).constructor.classType==="DomainModel":false;if(C){L=i(A);G=A.previousState}else{if(z in o){F=Object.keys(A);D=F.length;J={};for(var B=0;B<D;B++){if(o[z][F[B]]){J[o[z][F[B]]]=true}}K={};K.name=z;K.subscribers=Object.keys(J);K=!!K.subscribers.length?K:void (0)}if(z!==l){L[z]=A;L=i(w.state,L)}else{if(E){L=i(p(),A)}else{L=i(w.state,A)}}G=w.state;L=p(L,w.state,K)}G=G||{};Object.freeze(G);w=new x(L,G,y,E);H=w.state;if(!E&&!y){H.previousState=w.previousState}Object.freeze(H);u(H,z,I);return H};var x=q.call(this,n.bind(this,l));for(var m in r){if(r.hasOwnProperty(m)){k[m]=r[m].viewModel.call(this,n.bind(this,m));if("dependsOn" in r[m]){for(var s=0,t=r[m].dependsOn.length;s<t;s++){v=r[m].dependsOn[s].property.split(".");if(v.length>1){o[v[0]]=o[v[0]]||{};o[v[0]][v[1]]=o[v[0]][v[1]]||[];if(o[v[0]][v[1]].indexOf(m)===-1){o[v[0]][v[1]].push(m)}}}}}}return new x().init(j)}},{"./utils":8}],3:[function(f,g,j){var k=f("./imvvmModel");var p=f("./imvvmViewModel");var i=f("./imvvmDomainModel");var r=f("./mixin");var q=f("./utils");var n=q.extend;var m=q.mixInto;var l=function(){};var h=function(){};var o=function(){};m(l,k.Mixin);m(h,p.Mixin);m(o,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;return w}};var s={createModel:e.createClass.bind(this,l,"Model"),createViewModel:e.createClass.bind(this,h,"ViewModel"),createDomainModel:e.createClass.bind(this,o,"DomainModel"),mixin:r};g.exports=s},{"./imvvmDomainModel":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=g.call(this);n.proto.setState=m;var l=function(s,q,p,o){s=s||{};q=q||{};if(!("DataContext" in n.proto)){n.proto.DataContext=function(t,u){return n.proto.setState(t,u,true)}}if(!("init" in n.proto)){n.proto.init=function(){return this.DataContext()}}var r=Object.create(n.proto,n.descriptor);if(n.originalSpec.getInitialState){s=k(s,n.originalSpec.getInitialState.call(r,s,q))}if(!o&&!p){Object.defineProperty(r,"previousState",{configurable:false,enumerable:false,writable:false,value:q})}s.__proto__=r.__proto__;Object.defineProperty(r,"state",{configurable:false,enumerable:false,writable:false,value:s});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=g.call(this);var l=function(r,s,o){var q=Object.create(n.proto,n.descriptor);var t=arguments.length;var p=typeof Array.prototype.slice.call(arguments,-1)[0]==="boolean";if(t===0){r={};s={};o=true}else{if(t===1){if(p){o=r;r={};s={}}else{s=r;o=true}}else{if(t===2){if(p){o=s;s=r}else{o=true}}}}if(n.originalSpec.getInitialState){r=k(r,n.originalSpec.getInitialState.call(q,r,s))}if(o){Object.defineProperty(q,"context",{configurable:true,enumerable:true,set:function(u){this.setState=function(v,w){return m.bind(u).call(u,k(this.state,v),this.state,w)}.bind(this);delete this.context}})}Object.defineProperty(q,"state",{configurable:false,enumerable:false,writable:false,value:r});if(!o){Object.freeze(q)}return q};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=h.call(this);n.proto.setState=m;var l=function(p,q,r){r=r||{};p=k(p,q);n.proto.DataContext=l;if(!("init" in n.proto)){n.proto.init=function(){return this.DataContext()}}var o=Object.create(n.proto,n.descriptor);if(n.originalSpec.getInitialState){p=k(p,n.originalSpec.getInitialState.call(o,p,r))}Object.defineProperty(o,"state",{configurable:false,enumerable:false,writable:false,value:p});Object.keys(o).forEach(function(s){if(Object.prototype.toString.call(this[s])==="[object Object]"&&("context" in this[s])){this[s].context=this;Object.freeze(this[s])}if(Object.prototype.toString.call(this[s])==="[object Array]"){Object.freeze(this[s])}}.bind(o));p.__proto__=o.__proto__;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,l,m){this.setState({appContext:k},function(){if(typeof m==="function"){if(this.state===null||!("appContext" in this.state)){m(void (0))}else{if(l in this.state.appContext){m(this.state.appContext[l])}else{if(l===e){m(this.state.appContext)}else{m(void (0))}}}}}.bind(this))},getInitialState:function(){var k=f.getInitialState(e,this.props.domainModel,this.props.initArgs,this.props.domain,this.stateChangedHandler,this.props.disableUndo);return{appContext:k}}};i.exports=g},{"./core":2}],8:[function(h,g,f){var e={getDescriptor:function(){var k={};var j=this.prototype;for(var i in this.originalSpec){if(this.originalSpec.hasOwnProperty(i)){if("get" in this.originalSpec[i]||"set" in this.originalSpec[i]){if(!("enumerable" in this.originalSpec[i])){this.originalSpec[i].enumerable=true}k[i]=this.originalSpec[i]}else{j[i]=this.originalSpec[i]}}}if(!("extend" in j)){j.extend=e.extend}return{descriptor:k,proto:j,originalSpec:this.originalSpec||{}}},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)});

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

/**
* @jsx React.DOM
*/
/*jshint quotmark:false */
/*jshint white:false */
/*jshint trailing:false */
/*jshint newcap:false */
/* global AppViewModel, PersonsViewModel, HobbiesViewModel */

@@ -13,3 +6,2 @@

var domainObjects = {
/*jshint camelcase:false */
'persons': {

@@ -16,0 +8,0 @@ viewModel: PersonsViewModel,

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

/*jshint camelcase:false */
/* global IMVVM */

@@ -3,0 +2,0 @@

{
"name": "imvvm",
"description": "Immutable MVVM for React",
"version": "0.2.0-alpha",
"version": "0.2.1-alpha",
"keywords": [

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

@@ -30,3 +30,3 @@

if(desc.originalSpec.getInitialState){ //NEED to check -vv
if(desc.originalSpec.getInitialState){
nextState = extend(nextState, desc.originalSpec.getInitialState.call(model, nextState, previousState));

@@ -33,0 +33,0 @@ }

@@ -15,3 +15,8 @@

if(argCount === 1){
if(argCount === 0){
//defaults
nextState = {};
prevState = {};
withContext = true;
} else if(argCount === 1){
if(lastIsBoolean){

@@ -22,19 +27,15 @@ withContext = nextState;

} else {
//assume prevState is same as nextState
prevState = nextState;
withContext = true;
}
} else if(argCount === 2 && lastIsBoolean){
if(lastIsBoolean){
withContext = prevState;
prevState = {};
} else {
nextState = extend(prevState, nextState);
}
} else if(argCount === 3){
nextState = extend(prevState, nextState);
} else {
//defaults
nextState = {};
prevState = {};
withContext = true;
} else if(argCount === 2){
if(lastIsBoolean){
withContext = prevState;
prevState = nextState;
} else {
withContext = true;
}
}
//Initialize any props

@@ -41,0 +42,0 @@ if(desc.originalSpec.getInitialState){

@@ -50,2 +50,3 @@

//TODO - rework this, as __proto__ is deprecated
nextState.__proto__ = model.__proto__;

@@ -52,0 +53,0 @@ return Object.freeze(nextState);

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