Skip to content
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

feat: implement between #162

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

feat: implement between #162

wants to merge 2 commits into from

Conversation

aykutkardas
Copy link
Contributor

@aykutkardas aykutkardas commented Jan 17, 2023

I am trying to implement the between method.

If you have any suggestions it would be great to hear. @danielroe

Actually, it works now, but I was not able to import between directly. So I had to chain after "exactly".

exactly('').between('c', 'g')

@vercel
Copy link

vercel bot commented Jan 17, 2023

Someone is attempting to deploy a commit to a Personal Account owned by @danielroe on Vercel.

@danielroe first needs to authorize it.

@what-the-diff
Copy link

what-the-diff bot commented Jan 17, 2023

  • Added between input
  • Updated internal to support the new input
  • Tested that it works as expected in index test file

@didavid61202
Copy link
Collaborator

I think we could make this as a creating input helper similar to charIn.

some thoughts:

we could extends the original charIn helper to

export const charIn = <T extends string,From extends string, To extends string, Sets extends [from: From,to:To][]>(chars: T,...sets: Sets) =>
  createInput(`[${chars.replace(/[-\\^\]]/g, '\\$&')}${sets.map(set=>`${set[0]}-${set[1]}`).join()}]`) as Input<`[${EscapeChar<T>}${Join<{[k in keyof Sets]: `${Sets[k][0]}-${Sets[k][1]}`},'',''>}]`>

if we do so, we should also update charNotIn too.

then maybe add some helper functions for convenience:

export const charSet = <From extends string,To extends string>(from: From, to: To) =>
charIn('',[from,to])

export const charSets = <From extends string, To extends string, Sets extends [from: From,to: To][]>(...sets:Sets) =>
charIn('',...sets)

just some ideas, still need to make sure naming is intuitive. And maybe use function overloading if needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants