Some
Determines whether one of an object's members satisfies the specified test
Functional programming
- Typing:
(handler: (value: O[keyof O], key: keyof O) => boolean) => boolean
- Example:
import objectAsArray from "object-as-array";
export default function example() {
const obj = objectAsArray({
I : 1,
V : 5,
X : 10,
L : 50,
C : 100,
D : 500,
M : 1000
});
return obj.some((v, k) => k === 'L');
// Result: true
}
Modular programming
- Typing:
<O extends object>(object: O, handler: (value: O[keyof O], key: keyof O) => boolean) => boolean
- Example:
import some from "object-as-array/some";
export default function example() {
const obj = {
I : 1,
V : 5,
X : 10,
L : 50,
C : 100,
D : 500,
M : 1000
};
return some(obj, (v, k) => k === 'L');
// Result: true
}