Using unicode "U+3035" i.e. "vertical kana" symbol that bears resemblance to \
i.e. backward slash we can produce something like this :
Example 1
〵App〵Console〵Logger = console.log
〵App〵Console〵Logger("Hello World") // "Hello World"
Example 2
〵Window〵document = window.document // # ~ one-line
// # ~ multiple-line
〵WindowBase = window
〵Document = document
〵WindowBase .〵Document // # PAY ATTENTION at dot (.) between "namespaces"
User defined snippet
How to: write one of the prefixes in your IDE .js |.ts files e.g. kana and press tab (make sure
"editor.tabCompletion": "on"
)
{
// @https://code.visualstudio.com/docs/editor/userdefinedsnippets
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
"namespace_seperator_javascript": {
"scope": "javascript,typescript",
"prefix": ["sep", "kana", "js-namespace", "ts-namespace"],
"body": [
"〵$0"
],
"description": "JS, TS friendy unicode-based namespacing-like char"
}
}
Practical example – variadic function returning value of single type (filter_-ish_) function :
If you think it could be applicable, use it !
Cheers !
Top comments (0)