@ctx-core/function
Advanced tools
Comparing version 10.3.7 to 10.4.1
@@ -345,1 +345,13 @@ export declare type falsy = false | 0 | '' | null | undefined; | ||
export declare function ifelse(conditional: any, fn__if: any, fn__else: any): any; | ||
/** | ||
* Returns first obj property that is in the obj | ||
* @param obj | ||
* @param a1__name | ||
*/ | ||
export declare function or__in(obj: any, a1__name: any): any; | ||
/** | ||
* Returns first obj property that is truthy | ||
* @param obj | ||
* @param a1__name | ||
*/ | ||
export declare function or__property(obj: any, a1__name: any): any; |
@@ -582,2 +582,27 @@ 'use strict'; | ||
} | ||
/** | ||
* Returns first obj property that is in the obj | ||
* @param obj | ||
* @param a1__name | ||
*/ | ||
function or__in(obj, a1__name) { | ||
for (let i = 0; i < a1__name.length; i++) { | ||
const name = a1__name[i]; | ||
if (name in obj) | ||
return name; | ||
} | ||
} | ||
/** | ||
* Returns first obj property that is truthy | ||
* @param obj | ||
* @param a1__name | ||
*/ | ||
function or__property(obj, a1__name) { | ||
for (let i = 0; i < a1__name.length; i++) { | ||
const name = a1__name[i]; | ||
const value = obj[name]; | ||
if (value) | ||
return value; | ||
} | ||
} | ||
@@ -636,2 +661,4 @@ exports._a1__wrap = _a1__wrap; | ||
exports.or__fn = or__fn; | ||
exports.or__in = or__in; | ||
exports.or__property = or__property; | ||
exports.slice__a1__arg = slice__a1__arg; | ||
@@ -638,0 +665,0 @@ exports.tap = tap; |
{ | ||
"name": "@ctx-core/function", | ||
"version": "10.3.7", | ||
"version": "10.4.1", | ||
"description": "ctx-core function", | ||
@@ -37,3 +37,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "75e876bac72c5e7ceef4eba4dac44d783c6c3fe6" | ||
"gitHead": "f259d149680a8a776bbc0e7b1aae573e412596b0" | ||
} |
@@ -572,1 +572,24 @@ export type falsy = false|0|''|null|undefined | ||
} | ||
/** | ||
* Returns first obj property that is in the obj | ||
* @param obj | ||
* @param a1__name | ||
*/ | ||
export function or__in(obj, a1__name) { | ||
for (let i = 0; i < a1__name.length; i++) { | ||
const name = a1__name[i] | ||
if (name in obj) return name | ||
} | ||
} | ||
/** | ||
* Returns first obj property that is truthy | ||
* @param obj | ||
* @param a1__name | ||
*/ | ||
export function or__property(obj, a1__name) { | ||
for (let i = 0; i < a1__name.length; i++) { | ||
const name = a1__name[i] | ||
const value = obj[name] | ||
if (value) return value | ||
} | ||
} |
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
63748
2253