Gathering detailed insights and metrics for @karmaniverous/tagged-templates
Gathering detailed insights and metrics for @karmaniverous/tagged-templates
npm install @karmaniverous/tagged-templates
Typescript
Module System
Node Version
NPM Version
69.9
Supply Chain
98.8
Quality
75.7
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
18,982
Last Day
3
Last Week
13
Last Month
32
Last Year
9,442
2 Stars
16 Commits
2 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
0.1.2
Package Id
@karmaniverous/tagged-templates@0.1.2
Unpacked Size
13.48 kB
Size
2.97 kB
File Count
8
NPM Version
9.6.7
Node Version
18.12.1
Publised On
15 Aug 2023
Cumulative downloads
Total Downloads
Last day
200%
3
Compared to previous day
Last week
62.5%
13
Compared to previous week
Last month
700%
32
Compared to previous month
Last year
-1%
9,442
Compared to previous year
19
Here are some handy tagged template functions to make your ES6 template literals work better!
1npm install @karmaniverous/tagged-templates
1import { def, n2e, sn2e, sn2u } from '@karmaniverous/tagged-templates'; 2 3// Replicate default template literal functionality. Just FYI! 4console.log(def`a${'b'}c`); // 'abc' 5console.log(def`a${undefined}c`); // 'aundefinedc' 6 7// Replace any nil expression (i.e. null or undefined) with an empty string. 8console.log(n2e`a${undefined}c`); // 'ac' 9 10// Return an empty string if any expression is nil. 11console.log(sn2e`a${undefined}c`); // '' 12 13// Return null if any expression is nil. 14console.log(sn2n`a${undefined}c`); // null 15 16// Return undefined if any expression is nil. 17console.log(sn2u`a${undefined}c`); // undefined
string
Normalize a string by converting diacriticals to base characters, removing non-word characters, and converting to lower case.
Kind: static constant of taggedTemplates
Returns: string
- The normalized string or undefined if not a string.
Param | Type | Description |
---|---|---|
str | string | The string to normalize. |
string
Replicates standard string template behavior.
Kind: static constant of taggedTemplates
Returns: string
- The output string.
Param | Type | Description |
---|---|---|
strings | Array.<string> | The string literals. |
...exp | any | The expressions. |
string
Nil to Empty: replaces nil expressions with empty strings.
Kind: static constant of taggedTemplates
Returns: string
- The output string.
Param | Type | Description |
---|---|---|
strings | Array.<string> | The string literals. |
...exp | any | The expressions. |
string
Some Nil to Empty: returns empty string when any expression nil.
Kind: static constant of taggedTemplates
Returns: string
- The output string.
Param | Type | Description |
---|---|---|
strings | Array.<string> | The string literals. |
...exp | any | The expressions. |
string
Some Nil to Null: returns null when any expression nil.
Kind: static constant of taggedTemplates
Returns: string
- The output string.
Param | Type | Description |
---|---|---|
strings | Array.<string> | The string literals. |
...exp | any | The expressions. |
string
Some Nil to Undefined: returns undefined when any expression nil.
Kind: static constant of taggedTemplates
Returns: string
- The output string.
Param | Type | Description |
---|---|---|
strings | Array.<string> | The string literals. |
...exp | any | The expressions. |
See more great templates and other tools on my GitHub Profile!
No vulnerabilities found.
No security vulnerabilities found.