Created
July 12, 2017 00:16
-
-
Save wcalderipe/71da2974cfb43acbe1802779c2ac3cff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const flightBuilder = () => { | |
let flight = {} | |
const builder = { | |
withFlightCode: (flightCode) => { | |
flight.flightCode = flightCode | |
return builder | |
}, | |
withStops: (stops) => { | |
flight.stops = stops | |
return builder | |
}, | |
build: () => { | |
return flight | |
} | |
} | |
return builder | |
} | |
console.log(flightBuilder().withFlightCode('XL1234').withStops(2).build()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment