Rename the `this.name` to something other
See original GitHub issueBecause I need to do some weird stuff like this
const programName = this.name;
delete this.name;
// where `this` is the `prog` which is the "instance" of calling sade()
const handler = Object.assign(taskObj.handler, this);
// ! restore, because the help() needs it
this.name = programName;
return handler;
The case. I override a bit the .action
method, for few reasons. And in this method I have above code, because I need to return the handler function and I where I use it I need also access to the “instance”.
And in general, just “name” isn’t that good. Probably this.programName
makes more sense.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Change the name of your iPhone - Apple Support
Change the name of your iPhone · Go to Settings > General > About > Name. · Tap the Clear Text button ,...
Read more >Rename a file - Microsoft Support
Open File Explorer by going to My Computer, or by pressing Windows Key + E on your keyboard. Find the file you want...
Read more >Top 10 Reasons People Change Their Names | LegalZoom
A name change request can come about simply because a person doesn't like his or her name as given at birth. Perhaps they'd...
Read more >Name change - Wikipedia
Name change is the legal act by a person of adopting a new name different from their current name. Name change certificate issued...
Read more >Change your Google Account picture, name & other info
1. On your Android phone or tablet, open your device's Settings app . 2. Tap Google Manage your Google Account Personal info. 3....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you could extend Sade you’d still have this problem since the help text is built outside of the class, and that utility is passed the value. All it does it allow devs to manipulate the class in unforseen ways and then ping me when stuff breaks. No thanks, it does what it does
Really what you should have done here is initialize a singleton Sade instance and then exposed your own API that interfaced with the Sade instance privately. Would have worked just fine based on your description, and not been “ugly” - using it would have appeared like any other library usage.
I will take a look at this tomorrow. There are quite a few dependents now so I have to look thru some of them to see if any are reading the program
name
too.Exactly, that’s again about design architecture problem of Sade. If it wasn’t doing a few things outside the class none of these issues would exist.
Of course, I could create my own class or function and just replicate/mirror all the methods of Sade (like below), but that approach is unreliable and not future proof if Sade changes something (which probably won’t happen or won’t be so drastic, but still). Also, increases mine codebase unnecessarily and not because of some sane reason, but just because Sade wants to be closed for extending. Hence, the “O” in SOLID principles.
Cool, thanks. 😃