question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I’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:closed
  • Created 10 years ago
  • Comments:17

github_iconTop GitHub Comments

1reaction
chriseppsteincommented, Dec 1, 2013

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.

0reactions
robsonsobralcommented, Nov 1, 2016

I could use a simple way to split a ratio, like 16:9 or 3:4, into numbers.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found