mirror of
https://github.com/vale981/cl-scrape-telegram-api
synced 2025-03-05 08:11:37 -05:00
25 lines
717 B
Common Lisp
25 lines
717 B
Common Lisp
(defpackage :space.protagon.cl-telegram-scrape.utils
|
|
(:use :common-lisp :alexandria :cl-arrows)
|
|
(:export :lispify
|
|
:telegramify
|
|
:camel->symbol
|
|
:snake->keyword
|
|
:snake->symbol))
|
|
(in-package :space.protagon.cl-telegram-scrape.utils)
|
|
|
|
(defun lispify (str)
|
|
"Converts a snake case string to dash-style."
|
|
(string-upcase (cl-ppcre:regex-replace-all "_" str "-")))
|
|
|
|
(defun telegramify (str)
|
|
"Converts dash-style to snake-case."
|
|
(string-downcase (cl-ppcre:regex-replace-all "-" str "_")))
|
|
|
|
(defun camel->symbol (ident)
|
|
(intern (json:camel-case-to-lisp ident)))
|
|
|
|
(defun snake->keyword (str)
|
|
(-> str (lispify) (make-keyword)))
|
|
|
|
(defun snake->symbol (str)
|
|
(-> str (lispify) (intern)))
|