From d791ee003d28f997d10032e09e69f8d021bd9a6f Mon Sep 17 00:00:00 2001 From: Cord Slatton Date: Fri, 23 Aug 2024 14:50:48 -0700 Subject: [PATCH] resolve change requests for PR to Update job-writing-guide.md --- docs/jobs/job-writing-guide.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/jobs/job-writing-guide.md b/docs/jobs/job-writing-guide.md index dbc0e8cdc2e..99dc5efd334 100644 --- a/docs/jobs/job-writing-guide.md +++ b/docs/jobs/job-writing-guide.md @@ -251,7 +251,7 @@ state, and will return state.
What is a factory function? -Factory functions are cann be a difficult pattern to understand deeply. However, like many programming concepts, it makes more sense after some hands-on experience. Luckily, you don't need to deeply understand the pattern to understand OpenFn. +Factory functions are can be a difficult pattern to understand deeply. However, like many programming concepts, it makes more sense after some hands-on experience. Luckily, you don't need to deeply understand the pattern to understand OpenFn. Simply put, a factory function doesn't really do anything when executed. It simply returns a function to do something later. @@ -344,10 +344,12 @@ OpenFn will go off and fulfill the terms of that contract for you. The problem is that when you specify the terms of the contract, you don't have all the values to hand. We don't know what `state.data` is yet. So we need to say "WHEN you run this function, check the value of `state.data`, and use -whatever it says". "WHEN you run this function" is the key portion: how do we -ensure that the value of `state.data` is resolved at the right time? JavaScript -itself isn't built to do that - it'll just return the value when we read it (and -remember, we read it at load-time, not at run-time). +whatever it says". + +"WHEN you run this function" is the key portion: how do we ensure that the value +of `state.data` is resolved at the right time? JavaScript itself isn't built to +do that - it'll just return the value when we read it (and remember, we read it +at load-time, not at run-time). There are two good JavaScript-y solutions to the problem: @@ -1128,7 +1130,7 @@ fn(state => { }); ``` -You could use the _spread_ operator to override some keys: +You could use the spread operator to override some keys: ```js fn(state => {