abomination
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -1,2 +0,2 @@ | ||
import { FnImpl } from ".."; | ||
import { FnImpl } from '..'; | ||
export declare const concat: FnImpl; |
@@ -1,2 +0,2 @@ | ||
import { FnImpl } from ".."; | ||
import { FnImpl } from '..'; | ||
export declare const define: FnImpl; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.define = void 0; | ||
const guards_1 = require("../lib/guards"); | ||
const execute_1 = require("../lib/execute"); | ||
@@ -32,11 +31,5 @@ const define = (params, scope, fns) => { | ||
} : fns; | ||
const [scopeHead, ...scopeTail] = scope; | ||
const newScope = variableName | ||
? (0, guards_1.isScope)(scope) | ||
? { | ||
...scope, | ||
[variableName]: (0, execute_1.execute)(params['body'], scope, fns).value | ||
} | ||
: { | ||
[variableName]: (0, execute_1.execute)(params['body'], scope, fns).value | ||
} | ||
? [scopeHead, { [variableName]: (0, execute_1.execute)(params['body'], scope, fns).value }, ...scopeTail] | ||
: scope; | ||
@@ -43,0 +36,0 @@ return { |
@@ -1,2 +0,2 @@ | ||
import { FnImpl } from ".."; | ||
import { FnImpl } from '..'; | ||
export declare const map: FnImpl; |
@@ -14,3 +14,3 @@ "use strict"; | ||
return { | ||
value: array.map(item => (0, execute_1.execute)(params.map, item, fns).value), | ||
value: array.map(item => (0, execute_1.execute)(params.map, [item, ...scope], fns).value), | ||
scope, | ||
@@ -17,0 +17,0 @@ fns, |
@@ -1,2 +0,2 @@ | ||
import { FnImpl } from ".."; | ||
import { FnImpl } from '..'; | ||
export declare const value: FnImpl; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.value = void 0; | ||
const execute_1 = require("../lib/execute"); | ||
const guards_1 = require("../lib/guards"); | ||
const execute_1 = require("../lib/execute"); | ||
const value = (params, scope, fns) => { | ||
@@ -20,3 +20,3 @@ if (!params.name) | ||
throw new Error(`could not resolve value path "${path}" of type: ${typeof result}`); | ||
}, scope), | ||
}, scope.find(s => !parts[0] || ((0, guards_1.isScope)(s) && parts[0] in s))) || null, | ||
scope, | ||
@@ -23,0 +23,0 @@ fns, |
@@ -8,5 +8,5 @@ export declare type ReturnTypes = null | string | boolean | object | Array<ReturnTypes>; | ||
[key: string]: InputTypes; | ||
}, scope: ReturnTypes, fns: Functions) => { | ||
}, scope: ReturnTypes[], fns: Functions) => { | ||
value: ReturnTypes; | ||
scope: ReturnTypes; | ||
scope: ReturnTypes[]; | ||
fns: Functions; | ||
@@ -13,0 +13,0 @@ }; |
@@ -5,4 +5,4 @@ "use strict"; | ||
const execute_1 = require("./lib/execute"); | ||
const execute = (value, scope = {}, fns = {}) => (0, execute_1.execute)(value, scope, fns).value; | ||
const execute = (value, scope = {}, fns = {}) => (0, execute_1.execute)(value, [scope], fns).value; | ||
exports.execute = execute; | ||
exports.default = exports.execute; |
@@ -1,6 +0,6 @@ | ||
import { InputTypes, ReturnTypes, Functions } from ".."; | ||
export declare const execute: (value: InputTypes, scope: ReturnTypes, fns: Functions) => { | ||
import { Functions, InputTypes, ReturnTypes } from '..'; | ||
export declare const execute: (value: InputTypes, scope: ReturnTypes[], fns: Functions) => { | ||
value: ReturnTypes; | ||
scope: ReturnTypes; | ||
scope: ReturnTypes[]; | ||
fns: Functions; | ||
}; |
@@ -34,3 +34,3 @@ "use strict"; | ||
if (value instanceof Array) { | ||
return { value: value.map(entry => (0, exports.execute)(entry, scope, fns)), scope, fns }; | ||
return { value: value.map(entry => (0, exports.execute)(entry, scope, fns).value), scope, fns }; | ||
} | ||
@@ -48,3 +48,3 @@ if ((0, guards_1.isFn)(value)) { | ||
if (value instanceof Object) { | ||
return { value: Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, (0, exports.execute)(entry, scope, fns)])), scope, fns }; | ||
return { value: Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, (0, exports.execute)(entry, scope, fns).value])), scope, fns }; | ||
} | ||
@@ -51,0 +51,0 @@ throw new Error(`unrecognized function component type: ${typeof value}`); |
@@ -1,2 +0,2 @@ | ||
import { InputTypes, ReturnTypes } from ".."; | ||
import { InputTypes, ReturnTypes } from '..'; | ||
export declare const isFn: (input: any) => input is { | ||
@@ -3,0 +3,0 @@ fn: string; |
{ | ||
"name": "abomination", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"repository": { | ||
@@ -39,4 +39,3 @@ "type": "git", | ||
}, | ||
"dependencies": { | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
@@ -43,0 +42,0 @@ "@types/jest": "^27.4.1", |
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
67789
236