Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dep(): populateWithProperties => pick #8202

Merged
merged 8 commits into from
Aug 30, 2022
Merged

dep(): populateWithProperties => pick #8202

merged 8 commits into from
Aug 30, 2022

Conversation

ShaMan123
Copy link
Contributor

@ShaMan123 ShaMan123 commented Aug 28, 2022

signature changed

pick(source, keys) => new object

@github-actions
Copy link
Contributor

github-actions bot commented Aug 28, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   82.03 |    74.69 |   84.44 |   80.64 |                                               
 fabric.js |   82.03 |    74.69 |   84.44 |   80.64 | ...-27512,27628-27629,27650-27691,27706-27865 
-----------|---------|----------|---------|---------|-----------------------------------------------

@ShaMan123 ShaMan123 requested a review from asturur August 28, 2022 04:38
Copy link
Contributor Author

@ShaMan123 ShaMan123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

READY

@asturur
Copy link
Member

asturur commented Aug 28, 2022

no leave the util folder aloneeeee i m working on that

@ShaMan123
Copy link
Contributor Author

OK
but please make this function so that it returns a new object and doesn't mutate anything!

@asturur
Copy link
Member

asturur commented Aug 28, 2022

the pr is good do it when i l done there. I have 2 files left

@asturur
Copy link
Member

asturur commented Aug 30, 2022

OK but please make this function so that it returns a new object and doesn't mutate anything!

The old populateWithProperties was mutating objects that were created to be returned.
It wasn't bad per se. I agree that pick may be more useful and reusable than populateWithProperties that was a pick + assign.

@asturur
Copy link
Member

asturur commented Aug 30, 2022

The typing for pick is a bit too strict, as it is toObject.
We don't need to revert it now, but you have to consider a common thing that happen is that devs may want to add id, name or other values that are not part of the class, and export it.

Comment on lines +1038 to +1040
objects: this._objects
.filter((object) => !object.excludeFromExport)
.map((instance) => this._toObject(instance, methodName, propertiesToInclude)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure this is an improvement whatsover. is a bit harsh to read

@github-actions
Copy link
Contributor

Coverage after merging pick into master will be

80.90%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
dist
   fabric.js79.16%75.16%84.68%80.90%10004, 10016, 10030, 10059, 10076–10077, 10080, 10089–10090, 10090, 10090–10091, 10093–10095, 10102, 10102, 10102–10104, 10106–10107, 10114–10116, 10143–10145, 10147–10148, 10151–10152, 10223, 10242–10244, 10246–10247, 10309, 10363, 10378, 10434, 10470–10471, 10477, 10481–10482, 10497, 10531, 10562–10563, 10587, 10595, 10682, 1069, 10714–10715, 10790–10791, 10794, 10799, 10821, 10821, 10821, 10821, 10821, 10821, 10821–10822, 10824–10825, 10825, 10825–10826, 10831, 10833, 10839, 10839, 10839, 10839, 10839–10840, 10842–10846, 10846, 10846–10848, 10850–10851, 10860, 10871, 10882, 10893, 10903–10906, 10914–10915, 10915, 10915–10916, 10918–10919, 10926, 10930, 1144, 1146–1147, 1149–1150, 11527, 11532, 1157, 11574–11576, 11576, 11576, 11576, 11576, 11576–11577, 11597, 11602–11603, 1161, 11643, 11643, 11643, 11643, 11671, 11671, 11671, 11673, 1169, 11821–11822, 11833, 11990–11991, 11998, 12041, 12048, 12048, 1205, 12057–12058, 12069, 1207, 1207, 1207, 1207, 1207–1208, 12109, 12117, 12136–12138, 12165–12166, 12169, 12169, 12186–12188, 12291, 12376–12377, 12379–12380, 12387, 12411, 12476–12477, 12481, 12561, 12570, 12575, 12612, 12713, 12713, 12713, 12737–12738, 12846, 12849, 12911, 12917, 12924, 12931, 12937, 12943, 12950, 12957, 12963–12964, 12964, 12964, 12979–12980, 12988, 12997, 12997, 13022–13025, 13064, 13107–13108, 13148–13149, 13282–13283, 13428, 13520, 13583, 13586, 13639–13640, 13640, 13640, 13643, 13658, 13672, 13684–13685, 13687, 13699–13700, 13702, 13717, 13732–13733, 13735–13736, 13738–13739, 1374, 1374, 13749, 1376, 13779, 13779, 13779, 13779, 13779, 13779, 13779, 13779, 13804, 13806, 13806–13808, 13861–13863, 13886, 13894, 13900–13901, 13942, 14005–14006, 14040, 14061–14062, 14121, 14121, 14121, 14121, 14121, 14126–14134, 14176, 1426, 14302–14303, 14339, 14348, 14369, 14369, 14369–14370, 14370, 14370, 14370, 14370–14371, 14377–14379, 14382–14383, 14396, 14396, 14396–14397, 14397, 14397, 14397, 14397–14398, 14404–14406, 14409–14410, 14423–14424, 14498, 14547, 14551, 14676, 14706–14707, 14707, 14707–14708, 14708, 14708–14709, 14711, 14711, 14711–14712, 14715, 14722, 14807, 14920, 14969, 15039, 15043, 15113, 15170–15171, 15185, 15235–15236, 15238–15239, 15331, 15391, 15394, 1546, 15469, 15472, 15487–15488, 15497, 15539, 15543, 15568–15569, 15603, 15607, 15873, 15877, 16041, 16044, 16051–16052, 16052, 16052–16054, 16056, 16056, 16056–16058, 16058, 16058–16060, 1607, 16150, 16155–16157, 16185–16186, 16253, 16256, 16256, 16256–16257, 16259–16260, 16260, 16260–16261, 16261, 16261, 16263–16264, 16266, 16269, 16296, 16296–16298, 16347, 16347, 16382, 16417, 16417, 16417, 16420–16421, 16423, 16423, 16427, 16430, 16433, 16435–16436, 16445, 16450, 16450–16452, 16452, 16463–16464, 16473, 16473, 16473, 16473, 16473–16474, 16474, 16474–16476, 16476–16477, 16477, 16494–16495, 16495, 16495, 16517–16518, 16518, 16518, 16518, 16518, 16518, 16530, 16530, 16533–16537, 16537, 16576, 16615, 16647, 16650–16653, 16663, 16676, 16691, 16708, 16717, 16721, 16773, 16775–16777, 16791, 16793–16794, 16810, 16862, 16885, 17018, 17080–17082, 17082–17083, 17083, 17111, 17156–17159, 17166, 17168–17169, 1718, 17184–17186, 1719, 17196, 17196, 17196, 17259, 17271, 17271, 17318–17319, 17337–17338, 17359, 17401, 17401–17402, 17419–17422, 17422, 17422–17423, 17425, 17425, 17425–17426, 17428–17429, 17429, 17429–17430, 17432, 17432, 17432–17433, 17435–17436, 17440–17441, 17488, 17532, 176, 17601, 17606, 17630–17631, 17640–17644, 17656–17659, 17664, 17673–17674, 17676, 17685, 17685, 17685, 17685, 17685–17686, 17688–17689, 17705–17706, 17708–17709, 17716–17719, 17722, 17725, 17727–17728, 17728, 17728, 17728, 17728, 17728, 17728–17729, 17731, 17733–17734, 17734, 17734–17737, 17739, 17746–17754, 17754, 17754–17756, 17759, 17767–17770, 17776–17777, 17777, 17777–17778, 17780, 17780, 17780–17781, 17783, 17785–17786, 17801, 17803, 17803, 17803–17804, 17806–17807, 17807–17808, 17808, 17814, 17814, 17816, 17816–17817, 17817, 17826–17828, 17828, 17828–17836, 17842, 17842, 17842–17844, 17846, 17852–17853, 17867–17873, 17873, 17873–17874, 17877, 17879, 17891, 17891, 17891–17892, 17895–17897, 179, 17907, 17907, 17907–17909, 17921, 17921, 17921–17922, 17924–17925, 17925, 17925–17926, 17928–17929, 17929, 17929–17932, 17932, 17932–17933, 17935, 17935, 17935–17936, 17939–17940, 17943, 17945–17946, 17946, 17946, 17946, 17946–17948, 17962–17964,

Copy link
Member

@asturur asturur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ll open a task to revert the strict typing.

@asturur asturur merged commit 54b2fad into master Aug 30, 2022
@ShaMan123
Copy link
Contributor Author

I don't understand your comment regarding the typing of pick.
What is strict about it?

@asturur asturur deleted the pick branch September 11, 2022 23:02
frankrousseau pushed a commit to cgwire/fabric.js that referenced this pull request Jan 6, 2023
Co-authored-by: Andrea Bogazzi <andreabogazzi79@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants