This repository was archived by the owner on May 8, 2021. It is now read-only.

Description
This would be similar to the existing export, except with the params flipped, curryable, and defaults split into another export:
import { composableGet as get, composableGetOr as getOr } from 'ts-get';
// these are the same statement
get(obj => obj.a.b.c, inputObject);
get(obj => obj.a.b.c)(inputObject);
// these are the same statement
getOr(defaultValue, obj => obj.a.b.c, inputObject);
getOr(defaultValue, obj => obj.a.b.c)(inputObject);
getOr(defaultValue)(obj => obj.a.b.c, inputObject);
getOr(defaultValue)(obj => obj.a.b.c)(inputObject);
This would allow use with Ramda for things like the following (real simple example):
import { pipe, equals } from 'ramda';
import { composableGet as get } from 'ts-get';
import { getMetadataForIndex } from './whatever-utils';
export function satisfiesCriteria(index: number, type: string): boolean {
return pipe(
getMetadataForIndex, // this is passed index
get(metadata => metadata.a.b.c), // this is passed the output of getMetadataForIndex
equals(type) // this is passed the output of get
)(index);
};