Created
August 6, 2021 08:55
-
-
Save MarsiBarsi/c405752bba813fb4f4a6b1aee5fb09c7 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 environment = { | |
type: 'prod', | |
variables: { | |
api: 'some-url', | |
port: '8080' | |
} | |
} | |
const { | |
type: envType, // we extract "type" and call it "envType" here | |
variables: { api: envApi, ...envRest } // we extract "api" as "envApi" and add the rest into "envRest" | |
} = environment; | |
console.log(envType); // 'prod' | |
console.log(envApi); // 'some-url' | |
console.log(envRest); // {port: '8080'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment