diff --git a/README.md b/README.md index 9e6ef00..cf3e50f 100755 --- a/README.md +++ b/README.md @@ -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(, ..) ## 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(..)` ``` diff --git a/object.js b/object.js index 8c56b31..c34c9e5 100755 --- a/object.js +++ b/object.js @@ -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) diff --git a/package.json b/package.json index 3ba7dd1..b78a887 100755 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/test.js b/test.js index 570d85a..f6ea012 100755 --- a/test.js +++ b/test.js @@ -966,7 +966,7 @@ if(typeof(__filename) != 'undefined' '-verbose': { doc: 'verbose mode', - //env: 'VERBOSE', + env: 'VERBOSE', handler: function(){ module.VERBOSE = true } },