Cast function
See original GitHub issueI’ve found it very difficult to change from one data type to another in Sass (for instance strings to numbers, maps to strings (which can’t be done correctly without stack-breaking recursion), etc…) without dropping into Ruby to create helper functions. I think this functionality would be very useful, especially for framework developers. The proposed syntax would be something like the following:
$map: (foo: bar, baz: qux);
.foo {
content: cast($map, string);
}
$string: "Hello World How Are You";
@debug length(cast($string, list)); // 5
Issue Analytics
- State:
- Created 10 years ago
- Comments:17
Top Results From Across the Web
SQL Server CAST() Function - W3Schools
The CAST() function converts a value (of any type) into a specified datatype. Tip: Also look at the CONVERT() function. Syntax. CAST(expression AS...
Read more >SQL Server: CAST Function - TechOnTheNet
In SQL Server (Transact-SQL), the CAST function converts an expression from one datatype to another datatype. If the conversion fails, the function will ......
Read more >Cast() and Convert() Functions in SQL Server - C# Corner
The Cast() function is used to convert a data type variable or data from one data type to another data type. The Cast()...
Read more >SQL Server CAST Function By Practical Examples
In this tutorial, you will learn how to use the SQL Server CAST() function to convert a value or an expression from one...
Read more >SQL CAST Function Explained with Examples - Database Star
Purpose of the SQL CAST Function · Syntax · Parameters · Valid Data Types for Oracle Cast · Examples of the SQL CAST...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The inspect function turns any sass data structure into a string that would parse into equivalent sass (this is the same code we use for sass-convert).
I can’t think of any other use case for a generic
cast
. So I’m closing this.I could use a simple way to split a ratio, like
16:9
or3:4
, into numbers.