New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

actml

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

actml - npm Package Compare versions

Comparing version 0.10.0 to 0.10.1

1

lib/Element.js

@@ -74,2 +74,3 @@ 'use strict';

this.func = this.context[func];
this.name = (0, _utils.getFuncName)(this.func);
} else {

@@ -76,0 +77,0 @@ throw new Error('"' + func + '" is missing in the context.');

7

lib/middlewares/execute.js

@@ -97,3 +97,4 @@ 'use strict';

var props = element.props,
scope = element.scope;
scope = element.scope,
result = element.result;

@@ -103,3 +104,3 @@

if (typeof props.exports === 'function') {
var exportedProps = props.exports(element.result);
var exportedProps = props.exports(result);

@@ -111,3 +112,3 @@ Object.keys(exportedProps).forEach(function (key) {

} else {
scope[props.exports] = element.result;
scope[props.exports] = result;
element.dispatch(props.exports, element.result);

@@ -114,0 +115,0 @@ }

@@ -8,3 +8,3 @@ 'use strict';

var result = /function\*?\s+([\w\$]+)\s*\(/.exec(func.toString());
return result ? result[1] : '';
return result ? result[1] : 'unknown';
};

@@ -11,0 +11,0 @@

{
"name": "actml",
"version": "0.10.0",
"version": "0.10.1",
"description": "Like jsx but for your business logic",

@@ -5,0 +5,0 @@ "main": "lib",

@@ -16,3 +16,2 @@ # &lt;ActML /> :rocket: <!-- omit in toc -->

- [Wrapper that scopes everything](#wrapper-that-scopes-everything)
- [Running elements in parallel](#running-elements-in-parallel)
- [Error handling](#error-handling)

@@ -38,4 +37,4 @@ - [Examples](#examples)

```js
const Greeting = function({ name }) {
return `Hey ${name}!`;
const Greeting = function({ name, children }) {
children(`Hey ${name}!`);
};

@@ -72,3 +71,3 @@ async function GetProfileName() {

So, that is the concept of ActML. It allows us to define in a declarative fashion our business logic. Same as our UI. There is nothing (almost) imperative. In fact all the code that we pass to the `run` function is nothing but definitions of _what_ should happen. It is not saying _how_. This is extremely powerful concept because it shifts the responsibility to another level and makes the development a lot more easier. We use composition over raw implementation. If you like this way of thinking then ActML may be your way to deal with asynchronous logic.
So, that is the concept of ActML. It allows us to define in a declarative fashion our business logic. Same as our UI. There is nothing (almost) imperative. In fact all the code that we pass to the `run` function is nothing but definitions of _what_ should happen. It is not saying _how_. This is extremely powerful concept because it shifts the responsibility to another levels and makes the development a lot more easier. We use composition over raw implementation. If you like this way of thinking then ActML may be your way to deal with asynchronous logic.

@@ -157,4 +156,4 @@ ## What you need to use ActML

```js
const Foo = function (props) {
return `Hello ${ props.name }`;
const Foo = function ({ name, children }) {
children(`Hello ${ name }`);
}

@@ -194,3 +193,3 @@

Every ActML element has a `scope` object. It is really just a plain JavaScript object `{}` and every time when we use `exports` we are saving something there. For example the `scope` object of the `Foo` element is equal to `{ name: 'Jon Snow' }`. Together with creating the `name` variable in the `scope` of `Foo` we are also _sending_ an event to the parent `App` element. Then the `App` element should decide if it is interested in that variable or not. If yes then it keeps it in its scope. In the example above that is not happening so the `name` variable is only set in the scope of `<Foo>`. That is why in this latest example we will get `Zar: Jon Snow` followed by the error `Undefined variable "name".`.
Every ActML element has a `scope` object. It is really just a plain JavaScript object `{}` and every time when we use `exports` we are saving something there. For example the `scope` object of the `Foo` element is equal to `{ name: 'Jon Snow' }`. Together with creating the `name` variable in the `scope` of `Foo` we are also _sending_ an event to the parent `App` element. Then the `App` element should decide if it is interested in that variable or not. If yes then it keeps it in its scope. In the example above that is not happening so the `name` variable is only set in the scope of `<Foo>`. That is why in this latest example we will get `Zar: Jon Snow` followed by the error `Undefined variable "name" requested by <Bar>.`.

@@ -273,3 +272,3 @@ To solve the problem we have to instruct `<App>` element to _catch_ the `name` variable and also keeps it in its scope. This happens by the special prop called `scope`:

This wat `<Bar>` element will receive a prop called `len` which contains the number of letters in the `uppercaseName` variable.
`<Bar>` element will receive a prop called `len` which contains the number of letters in the `uppercaseName` variable.

@@ -334,15 +333,2 @@ ## Context API

### Running elements in parallel
```js
import { A, run, Parallel } from 'actml';
const Z = await function () { ... }
const M = function () { ... }
run(<Parallel><Z /><M /></Parallel>);
```
`Z` and `M` run in parallel which means that `M` is not waiting for `Z` to finish.
## Error handling

@@ -418,4 +404,4 @@

<App exports='answer'>
<Wrapper>
<Problem onError={ <HandleError /> } />
<Wrapper onError={ <HandleError /> }>
<Problem/>
<Z />

@@ -422,0 +408,0 @@ </Wrapper>

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