@ctx-core/function
Advanced tools
Comparing version 10.2.0 to 10.3.0
@@ -299,2 +299,9 @@ export declare type falsy = false | 0 | '' | null | undefined; | ||
/** | ||
* Returns a function than returns the called a1__fn(value) chained with ands | ||
* @param a1__fn | ||
*/ | ||
export declare function _and__fn__call(a1__fn: { | ||
(any: any): any; | ||
}[]): (value: any) => boolean; | ||
/** | ||
* Returns first truthy or last item in `__a1__value`. | ||
@@ -318,9 +325,16 @@ * @param {nowrap__a1} __a1__value | ||
/** | ||
* Returns function that returns first truthy or last item call or value in `__a1__value`. | ||
* @param {nowrap__a1} __a1__value | ||
* Returns function that returns first truthy or last item call or value in `a1__value`. | ||
* @param {nowrap__a1} a1__value | ||
* @returns {*} | ||
*/ | ||
export declare function _or__fn(__a1__value: any): (value: any) => any; | ||
export declare function _or__fn(a1__value: any): (value: any) => any; | ||
export declare const _fn__or__fn: typeof _or__fn; | ||
/** | ||
* Returns a function than returns first truthy value from a1__fn | ||
* @param a1__fn | ||
*/ | ||
export declare function _or__fn__call(a1__fn: { | ||
(any: any): any; | ||
}[]): (value: any) => any; | ||
/** | ||
* Returns `fn__if(conditional)` if `conditional` else `fn__else(conditional)` | ||
@@ -327,0 +341,0 @@ * @param conditional |
@@ -493,2 +493,17 @@ 'use strict'; | ||
/** | ||
* Returns a function than returns the called a1__fn(value) chained with ands | ||
* @param a1__fn | ||
*/ | ||
function _and__fn__call(a1__fn) { | ||
return value => { | ||
let value__ = true; | ||
for (let i = 0; i < a1__fn.length; i += 1) { | ||
value__ = value__ && a1__fn[i](value); | ||
if (!value__) | ||
return value__; | ||
} | ||
return value__; | ||
}; | ||
} | ||
/** | ||
* Returns first truthy or last item in `__a1__value`. | ||
@@ -533,11 +548,26 @@ * @param {nowrap__a1} __a1__value | ||
/** | ||
* Returns function that returns first truthy or last item call or value in `__a1__value`. | ||
* @param {nowrap__a1} __a1__value | ||
* Returns function that returns first truthy or last item call or value in `a1__value`. | ||
* @param {nowrap__a1} a1__value | ||
* @returns {*} | ||
*/ | ||
function _or__fn(__a1__value) { | ||
return value => or__fn(concat__wrap(__a1__value, value)); | ||
function _or__fn(a1__value) { | ||
return value => or__fn(concat__wrap(a1__value, value)); | ||
} | ||
const _fn__or__fn = _or__fn; | ||
/** | ||
* Returns a function than returns first truthy value from a1__fn | ||
* @param a1__fn | ||
*/ | ||
function _or__fn__call(a1__fn) { | ||
return value => { | ||
let value__; | ||
for (let i = 0; i < a1__fn.length; i += 1) { | ||
value__ = a1__fn[i](value); | ||
if (value__) | ||
return value__; | ||
} | ||
return value__; | ||
}; | ||
} | ||
/** | ||
* Returns `fn__if(conditional)` if `conditional` else `fn__else(conditional)` | ||
@@ -558,2 +588,3 @@ * @param conditional | ||
exports._and__fn = _and__fn; | ||
exports._and__fn__call = _and__fn__call; | ||
exports._andand = _andand; | ||
@@ -580,2 +611,3 @@ exports._andand_ = _andand_; | ||
exports._or__fn = _or__fn; | ||
exports._or__fn__call = _or__fn__call; | ||
exports._tap = _tap; | ||
@@ -582,0 +614,0 @@ exports._val = _val; |
{ | ||
"name": "@ctx-core/function", | ||
"version": "10.2.0", | ||
"version": "10.3.0", | ||
"description": "ctx-core function", | ||
@@ -37,3 +37,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "52b713fa7c5cf26cbe5ac4dde5f48979cb7b6b9e" | ||
"gitHead": "fd51c3303aed538f1ba930e4fd2733c81c2e46e0" | ||
} |
@@ -485,2 +485,16 @@ export type falsy = false|0|''|null|undefined | ||
/** | ||
* Returns a function than returns the called a1__fn(value) chained with ands | ||
* @param a1__fn | ||
*/ | ||
export function _and__fn__call(a1__fn:{ (any):any }[]) { | ||
return value=>{ | ||
let value__ = true | ||
for (let i = 0; i < a1__fn.length; i += 1) { | ||
value__ = value__ && a1__fn[i](value) | ||
if (!value__) return value__ | ||
} | ||
return value__ | ||
} | ||
} | ||
/** | ||
* Returns first truthy or last item in `__a1__value`. | ||
@@ -523,11 +537,25 @@ * @param {nowrap__a1} __a1__value | ||
/** | ||
* Returns function that returns first truthy or last item call or value in `__a1__value`. | ||
* @param {nowrap__a1} __a1__value | ||
* Returns function that returns first truthy or last item call or value in `a1__value`. | ||
* @param {nowrap__a1} a1__value | ||
* @returns {*} | ||
*/ | ||
export function _or__fn(__a1__value) { | ||
return value=>or__fn(concat__wrap(__a1__value, value)) | ||
export function _or__fn(a1__value) { | ||
return value=>or__fn(concat__wrap(a1__value, value)) | ||
} | ||
export const _fn__or__fn = _or__fn | ||
/** | ||
* Returns a function than returns first truthy value from a1__fn | ||
* @param a1__fn | ||
*/ | ||
export function _or__fn__call(a1__fn:{ (any):any }[]) { | ||
return value=>{ | ||
let value__ | ||
for (let i = 0; i < a1__fn.length; i += 1) { | ||
value__ = a1__fn[i](value) | ||
if (value__) return value__ | ||
} | ||
return value__ | ||
} | ||
} | ||
/** | ||
* Returns `fn__if(conditional)` if `conditional` else `fn__else(conditional)` | ||
@@ -534,0 +562,0 @@ * @param conditional |
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
61504
2158