@@ -30,14 +30,7 @@ pub enum DependencyGroup {
30
30
}
31
31
32
32
impl DependencyGroup {
33
- pub const VALUES : [ Self ; 4 ] = [
34
- Self :: Dependencies ,
35
- Self :: DevDependencies ,
36
- Self :: OptionalDependencies ,
37
- Self :: PeerDependencies ,
38
- ] ;
39
-
40
- pub ( crate ) const STRINGS : [ & str ; 4 ] = [
33
+ pub ( crate ) const VALUES : [ & str ; 4 ] = [
41
34
"dependencies" ,
42
35
"devDependencies" ,
43
36
"optionalDependencies" ,
@@ -94,7 +87,7 @@ impl PackageManifest {
94
87
where
95
88
S : AsRef < str > ,
96
89
{
97
- DependencyGroup :: STRINGS
90
+ DependencyGroup :: VALUES
98
91
. iter ( )
99
92
// only iterate over the objects corresponding to each dependency group
100
93
. filter_map ( |dependency_group| {
@@ -114,7 +107,7 @@ impl PackageManifest {
114
107
}
115
108
116
109
pub fn dependencies_iter ( & self ) -> impl Iterator < Item = ( & String , & serde_json:: Value ) > {
117
- DependencyGroup :: STRINGS
110
+ DependencyGroup :: VALUES
118
111
. iter ( )
119
112
. filter_map ( |dependency_group| {
120
113
self . contents
@@ -129,7 +122,7 @@ impl PackageManifest {
129
122
& ' a self ,
130
123
package_manifests_by_package_name : & ' a HashMap < String , PackageManifest > ,
131
124
) -> impl Iterator < Item = & ' a PackageManifest > {
132
- DependencyGroup :: STRINGS
125
+ DependencyGroup :: VALUES
133
126
. iter ( )
134
127
// only iterate over the objects corresponding to each dependency group
135
128
. filter_map ( |dependency_group| {
@@ -178,17 +171,6 @@ impl PackageManifest {
178
171
. collect ( )
179
172
}
180
173
181
- // REFACTOR: return an iterator
182
- pub fn get_dependency_group_mut (
183
- & mut self ,
184
- group : DependencyGroup ,
185
- ) -> Option < & mut serde_json:: Map < String , serde_json:: Value > > {
186
- self . contents
187
- . extra_fields
188
- . get_mut ( group. as_str ( ) )
189
- . and_then ( serde_json:: Value :: as_object_mut)
190
- }
191
-
192
174
// REFACTOR: for nearness
193
175
// Name of the archive generated by `npm pack`, for example "myscope-a-cool-package-1.0.0.tgz"
194
176
pub fn npm_pack_file_basename ( & self ) -> String {
0 commit comments