Skip to content

Commit

Permalink
fix(types): reach and getIn make last 2 arguments optional (#1194)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthew Wong <matthew@eduka.com>
  • Loading branch information
mattywong and Matthew Wong committed Dec 22, 2020
1 parent e6dbef1 commit 5cf2c48
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util/reach.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { forEach } from 'property-expr';

let trim = (part: string) => part.substr(0, part.length - 1).substr(1);

export function getIn(schema: any, path: string, value: any, context = value) {
export function getIn(schema: any, path: string, value?: any, context = value) {
let parent: any, lastPart: string, lastPartDebug: string;

// root path: ''
Expand Down Expand Up @@ -50,7 +50,7 @@ export function getIn(schema: any, path: string, value: any, context = value) {
return { schema, parent, parentPath: lastPart! };
}

const reach = (obj: {}, path: string, value: any, context: any) =>
const reach = (obj: {}, path: string, value?: any, context?: any) =>
getIn(obj, path, value, context).schema;

export default reach;

0 comments on commit 5cf2c48

Please sign in to comment.