mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Use .slice() for all substring-ing (#26677)
- substr is Annex B - substring silently flips its arguments if they're in the "wrong order", which is confusing - slice is better than sliced bread (no pun intended) and also it works the same way on Arrays so there's less to remember --- > I'd be down to just lint and enforce a single form just for the potential compression savings by using a repeated string. _Originally posted by @sebmarkbage in https://github.com/facebook/react/pull/26663#discussion_r1170455401_
This commit is contained in:
@@ -172,7 +172,7 @@ function getTarOptions(tgzName, packageName) {
|
||||
entries: [CONTENTS_FOLDER],
|
||||
map(header) {
|
||||
if (header.name.indexOf(CONTENTS_FOLDER + '/') === 0) {
|
||||
header.name = header.name.substring(CONTENTS_FOLDER.length + 1);
|
||||
header.name = header.name.slice(CONTENTS_FOLDER.length + 1);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user