goog.isDateLike is triggered by others' sketchy practices
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- clojure, javascript
- Ambito
- tooling
Direzione di ricerca
Inizia esaminando goog.isDateLike in closure/goog/base.js, in particolare i suoi controlli goog.isObject e getFullYear, e confronta tale comportamento con i controlli a runtime di cljs-oops. Il lavoro è completo quando i chiamanti possono disabilitare indipendentemente il controllo date-like lasciando abilitati gli altri controlli; il contenuto non indica file del progetto o test da eseguire.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I've had to stop using cljs-oops for a subset of my uses, specifically https://capacitorjs.com plugins[1], because their top-level plugin modules return a Proxy that behaves somewhat like this (not exactly, but this achieves a similar effect):
const p = new Proxy({}, {get: () => () => true})
That is to say, typeof p.anythingAtAll is 'function'.
Unfortunately, goog.isDateLike only looks for goog.isObject and typeof val.getFullYear == 'function'.
I fully appreciate that this style of duck-typed checking is common in JS, including for promises (as thenables) and similar -- and also that this is more of an upstream quirk than anything else.
That said, given that upstream libraries can't always be changed, I wanted to propose configuration to pick which of the safety checks are run, one at a time (maybe a set like #{:date-like :string-like ...}?)
I find that I rarely trigger the date-like check in ordinary use and disabling it for my own codebase would be helpful for this situation -- on the other hand, I find the other runtime checks valuable and do run into them, so I would love to leave them enabled.
I almost wrote the PR alongside the issue, but I wanted to get your thoughts before doing so, in case you have a preference for how such a thing would work.
Thanks so much for the library -- I like it enough to have wrapped it at https://github.com/tekacs/access in a different syntax, which is primarily how I use it. :)
[1]: such as @capacitor/filesystem, which returns the output of registerPlugin in @capacitor/core
- Lingua principale
- Clojure
- Stelle
- 350
- Fork
- 13
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di binaryage/cljs-oops
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
-
oset being strict Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
Tutte le issue di binaryage/cljs-oops
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
.Team/Metabot Priority:P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
needs triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
scalar-labs/scalar-jepsen#222 · 1 commento ·