-
Notifications
You must be signed in to change notification settings - Fork 38
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
string.split
missing but present in dart-sass 1.57.0
#95
Comments
Here is the current source code for /// The Sass string module.
final module = BuiltInModule("string", functions: <Callable>[
_unquote, _quote, _toUpperCase, _toLowerCase, _length, _insert, _index, //
_slice, _uniqueId,
_function("split", r"$string, $separator, $limit: null", (arguments) {
var string = arguments[0].assertString("string");
var separator = arguments[1].assertString("separator");
var limit = arguments[2].realNull?.assertNumber("limit").assertInt("limit");
if (limit != null && limit < 1) {
throw SassScriptException("\$limit: Must be 1 or greater, was $limit.");
}
if (string.text.isEmpty) {
return const SassList.empty(
separator: ListSeparator.comma, brackets: true);
} else if (separator.text.isEmpty) {
return SassList(
string.text.runes.map((rune) =>
SassString(String.fromCharCode(rune), quotes: string.hasQuotes)),
ListSeparator.comma,
brackets: true);
}
var i = 0;
var lastEnd = 0;
var chunks = <String>[];
for (var match in separator.text.allMatches(string.text)) {
chunks.add(string.text.substring(lastEnd, match.start));
lastEnd = match.end;
i++;
if (i == limit) break;
}
chunks.add(string.text.substring(lastEnd));
return SassList(
chunks.map((chunk) => SassString(chunk, quotes: string.hasQuotes)),
ListSeparator.comma,
brackets: true);
}),
]); |
xpe
pushed a commit
to xpe/grass
that referenced
this issue
May 5, 2024
connorskees
pushed a commit
that referenced
this issue
May 11, 2024
Co-authored-by: David James <[email protected]>
closed by #96 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
grass doesn't yet support
string.split
, which has been available in dart-sass since 1.57.0.https://sass-lang.com/documentation/modules/string/#split
The text was updated successfully, but these errors were encountered: