added doc/text template string tags...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-08-02 20:29:45 +03:00
parent 979d8cb5bb
commit 817fda0ef7
4 changed files with 24 additions and 5 deletions

View File

@ -144,7 +144,7 @@ class B extends A {
- [`RawInstance(..)`](#rawinstance)
- [`Constructor(..)` / `C(..)`](#constructor--c)
- [Utilities](#utilities)
- [`normalizeIndent(..)` / `normalizeTextIndent(..)`](#normalizeindent--normalizetextindent)
- [`normalizeIndent(..)` / `normalizeTextIndent(..)` / `doc` / `text`](#normalizeindent--normalizetextindent--doc--text)
- [`deepKeys(..)`](#deepkeys)
- [`match(..)`](#match)
- [`matchPartial(..)`](#matchpartial)
@ -867,7 +867,7 @@ C(<name>, ..)
## Utilities
### `normalizeIndent(..)` / `normalizeTextIndent(..)`
### `normalizeIndent(..)` / `normalizeTextIndent(..)` / `doc` / `text`
Align _code_ to shortest leading white-space
```
@ -894,6 +894,9 @@ normalizeTextIndent(..)
This ignores `object.LEADING_TABS` and `leading_tabs` is 0 by default.
`doc` and `text` are template string versions of `normalizeIndent(..)` and `normalizeTextIndent(..)` respectively.
### `deepKeys(..)`
```

View File

@ -120,6 +120,22 @@ function(text, tab_size, leading_tabs){
return module.normalizeIndent(text, tab_size, leading_tabs || 0) }
// template string tag versions of the above...
var doc =
module.doc =
function(strings, ...values){
return normalizeIndent(strings
.map(function(s, i){ return s + (values[i] || '') })
.join('')) }
var text =
module.text =
function(strings, ...values){
return normalizeTextIndent(strings
.map(function(s, i){ return s + (values[i] || '') })
.join('')) }
// Get keys from prototype chain...
//
// deepKeys(obj)

View File

@ -1,6 +1,6 @@
{
"name": "ig-object",
"version": "5.0.15",
"version": "5.1.15",
"description": "",
"main": "object.js",
"scripts": {
@ -28,6 +28,6 @@
"devDependencies": {
"c8": "^7.2.1",
"colors": "^1.4.0",
"ig-argv": "^2.10.3"
"ig-argv": "^2.11.2"
}
}

View File

@ -966,7 +966,7 @@ if(typeof(__filename) != 'undefined'
'-verbose': {
doc: 'verbose mode',
//env: 'VERBOSE',
env: 'VERBOSE',
handler: function(){
module.VERBOSE = true }
},