Add into to prelude #51

Closed
probablycorey wants to merge 1 commits from add-into into main

To get advent of code to work I needed type casting and couldn't find any in the prelude. I looked around for a simple implementation and stole nushell's into

5 | into string is "5"
"33 | into number is 33

It does booleans too and throws an error if it can't convert the given value.

BUT

Maybe it would be better to just copy what js does

string 4

or

number "34"

That is pretty clear and might be better

cc @defunkt

To get advent of code to work I needed type casting and couldn't find any in the prelude. I looked around for a simple implementation and stole nushell's `into` `5 | into string` is `"5"` `"33 | into number` is `33` It does booleans too and throws an error if it can't convert the given value. **BUT** Maybe it would be better to just copy what js does `string 4` or `number "34"` That is pretty clear and might be better cc @defunkt
probablycorey added 1 commit 2025-12-02 19:41:13 +00:00
Owner

I like string 4 and number "34!

I like `string 4` and `number "34`!
Owner

added string number and boolean in 59b92714d2

added `string` `number` and `boolean` in 59b92714d2f32be00dd39d753650935bd4f16890
defunkt closed this pull request 2025-12-09 15:49:40 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: probablycorey/shrimp#51
No description provided.