Created
April 16, 2025 15:15
-
-
Save saurookadook/89547fdaf69e8bbd3266e05f012e3d62 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| function logAttrs({ displayName, obj }) { | |
| console.group(displayName); | |
| for (const [key, value] of Object.entries(obj)) { | |
| console.log(`${key}: ${value}`); | |
| } | |
| console.groupEnd(); | |
| } | |
| (function() { | |
| const commonArgs = { | |
| bodyId: 'modalBody', | |
| headingId: 'modalHeading', | |
| id: 'modal', | |
| nested: [] | |
| }; | |
| const StoryOne = { | |
| displayName: 'StoryOne', | |
| args: { | |
| ...commonArgs | |
| } | |
| } | |
| const StoryTwo = { | |
| displayName: 'StoryTwo', | |
| args: { | |
| ...commonArgs | |
| } | |
| } | |
| logAttrs({ displayName: 'commonArgs', obj: commonArgs }); | |
| logAttrs({ displayName: StoryOne.displayName, obj: StoryOne.args }); | |
| logAttrs({ displayName: StoryTwo.displayName, obj: StoryTwo.args }); | |
| StoryOne.args.bodyId = 'MEOW'; | |
| StoryOne.args.headingId = 'WOOF' | |
| StoryOne.args.nested.push(4) | |
| StoryTwo.args.id = 'hehehehehe' | |
| StoryTwo.args.nested.push(2) | |
| logAttrs({ displayName: 'commonArgs', obj: commonArgs }); | |
| logAttrs({ displayName: StoryOne.displayName, obj: StoryOne.args }); | |
| logAttrs({ displayName: StoryTwo.displayName, obj: StoryTwo.args }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment