New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@pro-functional/objects

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pro-functional/objects

Tools to simplify pure functions

latest
Source
npmnpm
Version
0.11.0
Version published
Maintainers
1
Created
Source

Objects

Installation

yarn add --exact @pro-functional/objects

Tools

isObject A type checker to evaluate the given value as an NonNullable<object>

isObject(null)
// false

isObject(undefined)
// false

isObject(5)
// false

isObject('random value')
// false

isObject({})
// true

isObjectWithProps A type checker that verifies the provided value to be an object with the provided property keys

isObjectWithProps(null, 'name', 'id')
// false

isObjectWithProps(undefined, 'name', 'id')
// false

isObjectWithProps(5, 'name', 'id')
// false

isObjectWithProps('random value', 'name', 'id')
// false

isObjectWithProps({}, 'name', 'id')
// false

isObjectWithProps({ name: 'bob' }, 'name', 'id')
// false

isObjectWithProps({ name: 'bob', id: '007', uid: 'ga98as7fuhk' }, 'name', 'id')
// true

interface User {
    name: string
    id: string
}

const maybeUser = { name: 'bob', id: '007', uid: 'ga98as7fuhk' }

const user: User | null = isObjectWithProps(maybeUser, 'name', 'id')
    ? maybeUser
    : null
// ✅ assignment is type-correct

makeEnumResolver Create a resolver for an Enum allowing you to map a text back to the enum. The fallback allows a guaranteed response.

enum Colors {
    Green = 'green',
    Blue = 'blue',
    Invalid = 'invalid',
}

const resolveColor = makeEnumResolver(Colors, Colors.Invalid)

resolveColor('green')
// Colors.Green

resolveColor('blue')
// Colors.Blue

resolveColor('purple')
// Colors.Invalid

Keywords

functional

FAQs

Package last updated on 10 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts