feat(transformer): support Targets::from_query method (#5336)

This commit is contained in:
Dunqing 2024-08-30 09:30:16 +00:00
parent 3d4a64c811
commit d04857bd35

View file

@ -29,6 +29,13 @@ impl Default for Targets {
}
impl Targets {
/// Create a `Targets` from a browserslist query.
///
/// The usage refer to the [browserslist](https://github.com/browserslist/browserslist?tab=readme-ov-file#queries) documentation.
pub fn from_query(query: &str) -> Self {
Targets::Query(Query::Single(query.into()))
}
/// Parse the query and return the parsed Versions.
///
/// # Errors