JSPM

property-value

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q50318F
  • License MIT

A template for creating npm packages using TypeScript and VSCode

Package Exports

  • property-value
  • property-value/package.json

Readme

property-value

npm package Build Status Downloads Issues Code Coverage

Module to get property value with property path

Install

npm install property-value

Usage

import { getPropertyValue } from 'property-value';

interface Person {
  age: number;
  name: {
    first: string;
    middle?: string;
    last: string;
  };
}

const p: Person = {
  age: 15,
  name: {
    first: 'Yuyi',
    last: 'Xue',
  },
};

const firstName = getPropertyValue(p, 'name.first');
//=> 'Yuyi'

API

getPropertyValue<T, P>(obj: T, path: P)

obj

Type: object

The source object

path

Type: string

The path of the property to be received