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

@webqit/subscript

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webqit/subscript - npm Package Compare versions

Comparing version 2.0.9 to 2.0.10

test/null.js

2

package.json

@@ -11,3 +11,3 @@ {

"homepage": "https://webqit.io/tooling/subscript",
"version": "2.0.9",
"version": "2.0.10",
"license": "MIT",

@@ -14,0 +14,0 @@ "repository": {

@@ -56,7 +56,7 @@ # Subscript

You'll also notice one additional *dependent* at each level of the chain. That gives us the *dependency thread* for `count` as: statement `2` -> statement `3` -> statement `5` -> statement `6` -> statement `8`; excluding statements `1`, `4`, `7`.
You'll also notice one additional *dependent* at each level of the chain. That brings the *dependency thread* for `count` to the following sequence: statement `2` -> statement `3` -> statement `5` -> statement `6` -> statement `8`; excluding statements `1`, `4`, `7`.
🤝 Good analysis! But what's the deal?
Programs are generally expected to run **in whole**, **not in dependency threads**! It would take some magic to have the latter, but... now, that's what's for dinner with Subscript! 😁
Programs are generally expected to run **in whole**, **not in dependency threads**! It would take some magic to have the latter. But... well, that's what's for dinner with Subscript! 😁

@@ -112,3 +112,3 @@ Problem is: the mathematical relationship above only holds for as long as nothing changes. Should the value of `count` change, then its dependents are sure out of sync.

\> Run `render` in dependency threads…
\> Run just the `count` dependency thread…

@@ -317,3 +317,3 @@ ```js

#### Logical And Ternary Operators
#### Logical And Ternary Expressions

@@ -343,3 +343,3 @@ Subscript observes the state of logical (`a && b || c`) and ternary (`a ? b : c`) expressions when running dependency threads.

<sup>*</sup>Since expressions in the "consequent" and "alternate" sides of a conditional or logical expression are mutually exclusive (`b` and `c` above), as determined by the "test" expression (`a()` above), only the thread events for the references in the currently active side (`b` above) are honoured by the expression.
<sup>*</sup>Since expressions in the "consequent" and "alternate" sides of a conditional or logical expression are mutually exclusive (`b` and `c` above), as determined by the "test" expression (`a()` above), only the thread events for the references in the currently active side (`b` above) are honoured by the expression at any given point in time.

@@ -346,0 +346,0 @@ ### Loops

@@ -17,2 +17,3 @@

this.ownerContext = ownerContext;
this.ownerUnit = ownerContext.currentUnit || ownerContext;
this.parent = ownerContext.currentCondition;

@@ -32,2 +33,6 @@ }

get lineage() {
return `${ this.ownerUnit.lineage }:${ this.id }`;
}
toJson( filter = false ) {

@@ -44,6 +49,6 @@ let json = { id: this.id };

if ( this.parent ) {
if ( this.parent.ownerContext.id === this.ownerContext.id ) {
if ( this.parent.ownerUnit.id === this.ownerUnit.id ) {
json.parent = this.parent.id;
} else {
json.parent = `${ this.parent.ownerContext.lineage }:${ this.parent.id }`;
json.parent = `${ this.parent.ownerUnit.lineage }:${ this.parent.id }`;
}

@@ -50,0 +55,0 @@ }

@@ -46,3 +46,3 @@

toJson( filter = false ) {
let { id, conditionId, referenceId, ...json } = super.toJson( filter );
let { id, condition, referenceId, ...json } = super.toJson( filter );
let subscriptions = {};

@@ -62,3 +62,3 @@ let $subscriptions = {};

$subscriptions,
conditionId,
condition,
referenceId,

@@ -65,0 +65,0 @@ }

@@ -59,3 +59,3 @@

$path: this.isDotSafe ? this.path.map( identifier => identifier.name ).join( '.' ) : undefined,
conditionId: ( this.condition || {} ).id,
condition: ( this.condition || {} ).lineage,
referenceId: this.ownerReference.id,

@@ -62,0 +62,0 @@ }

@@ -30,8 +30,2 @@

this.entryStack = [];
if ( this.ownerContext && this.ownerContext.currentCondition ) {
let condition = new Condition( this.ownerContext || this, this.nextId( 'condition' ), {} );
this.entries.unshift( condition );
// Keep in stack while callback runs
this.entryStack.unshift( condition );
}
// Memos

@@ -57,4 +51,4 @@ this.memos = [];

nextId( name ) {
if ( this.ownerContext ) return this.ownerContext.nextId( name );
name = '';
if ( this.ownerContext ) return this.ownerContext.nextId( name );
if ( typeof this._nextIds[ name ] === 'undefined' ) { this._nextIds[ name ] = 0; }

@@ -212,3 +206,4 @@ return this._nextIds[ name ] ++;

get currentCondition() {
return this.entryStack.reduce( ( condition, current ) => condition || ( current instanceof Condition ) && current, null );
return this.entryStack.reduce( ( condition, current ) => condition || ( current instanceof Condition ) && current, null )
|| ( this.closestFunction() !== this && this.ownerContext && this.ownerContext.currentCondition );
}

@@ -432,12 +427,11 @@

let offset = this.lineage.split( '/' ).length;
let find = lineage => lineage.reduce( ( _json, id ) => _json.subUnits[ id ], json );
this.entries.slice( 0 ).reverse().forEach( entry => {
let target;
if ( entry instanceof Unit ) {
target = entry.lineage.split( '/' ).slice( offset, -1 ).reduce( ( subUnits, id ) => subUnits[ id ].subUnits, json.subUnits );
let target = find( entry.lineage.split( '/' ).slice( offset, -1 ) );
target.subUnits[ entry.id ] = entry.toJson( filter );
} else if ( entry instanceof Condition ) {
target = json.conditions;
let target = find( entry.ownerUnit.lineage.split( '/' ).slice( offset ) );
target.conditions[ entry.id ] = entry.toJson( filter );
}
if ( target ) {
target[ entry.id ] = entry.toJson( filter );
}
} );

@@ -444,0 +438,0 @@

@@ -214,5 +214,5 @@

if ( !this.compute( computes ) ) return;
if ( effectRef.conditionId !== undefined && !this.assert( effectRef.conditionId ) ) return;
if ( effectRef.condition !== undefined && !this.assert( effectRef.condition ) ) return;
} else if ( !shouldMatchEventRef ) {
shouldMatchEventRef = computes.length || effectRef.conditionId !== undefined;
shouldMatchEventRef = computes.length || effectRef.condition !== undefined;
}

@@ -319,3 +319,3 @@ let subscriptionsObject = isSideEffect ? effectRef.$subscriptions : effectRef.subscriptions;

if ( !this.compute( ref.computes ) ) return;
if ( ref.conditionId !== undefined && !this.assert( ref.conditionId ) ) return;
if ( ref.condition !== undefined && !this.assert( ref.condition ) ) return;
return true;

@@ -391,18 +391,18 @@ } );

assert( conditionId ) {
if ( typeof conditionId === 'string' && conditionId.includes( ':' ) ) {
let [ unitUrl, _conditionId ] = conditionId.split( ':' );
return this.locate( unitUrl ).assert( _conditionId );
assert( condition ) {
if ( typeof condition === 'string' && condition.includes( ':' ) ) {
let [ unitUrl, _condition ] = condition.split( ':' );
return this.locate( unitUrl ).assert( _condition );
}
let condition = this.graph.conditions[ conditionId ],
memo = this.unit.memo;
if ( 'parent' in condition && !this.assert( condition.parent ) ) return false;
if ( 'switch' in condition ) {
return condition.cases.some( _case => memo[ _case ] === memo[ condition.switch ] );
let conditionDef = this.graph.conditions[ condition ];
let memo = this.unit.memo;
if ( typeof conditionDef.parent !== 'undefined' && !this.assert( conditionDef.parent ) ) return false;
if ( typeof conditionDef.switch !== 'undefined' ) {
return conditionDef.cases.some( _case => memo[ _case ] === memo[ conditionDef.switch ] );
}
if ( 'whenNot' in condition ) {
return memo[ condition.whenNot ];
if ( typeof conditionDef.whenNot !== 'undefined' ) {
return memo[ conditionDef.whenNot ];
}
if ( 'when' in condition ) {
return memo[ condition.when ];
if ( typeof conditionDef.when !== 'undefined' ) {
return memo[ conditionDef.when ];
}

@@ -409,0 +409,0 @@ return true;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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