diff --git a/packages/string-templates/manifest.json b/packages/string-templates/manifest.json index cd787bc850..d06a01f606 100644 --- a/packages/string-templates/manifest.json +++ b/packages/string-templates/manifest.json @@ -7,7 +7,7 @@ "numArgs": 1, "example": "{{ abs 12012.1000 }} -> 12012.1", "description": "

Return the magnitude of a.

\n", - "isBlock": false + "requiresBlock": false }, "add": { "args": [ @@ -17,7 +17,7 @@ "numArgs": 2, "example": "{{ add 1 2 }} -> 3", "description": "

Return the sum of a plus b.

\n", - "isBlock": false + "requiresBlock": false }, "avg": { "args": [ @@ -26,7 +26,7 @@ "numArgs": 1, "example": "{{ avg 1 2 3 4 5 }} -> 3", "description": "

Returns the average of all numbers in the given array.

\n", - "isBlock": false + "requiresBlock": false }, "ceil": { "args": [ @@ -35,7 +35,7 @@ "numArgs": 1, "example": "{{ ceil 1.2 }} -> 2", "description": "

Get the Math.ceil() of the given value.

\n", - "isBlock": false + "requiresBlock": false }, "divide": { "args": [ @@ -45,7 +45,7 @@ "numArgs": 2, "example": "{{ divide 10 5 }} -> 2", "description": "

Divide a by b

\n", - "isBlock": false + "requiresBlock": false }, "floor": { "args": [ @@ -54,7 +54,7 @@ "numArgs": 1, "example": "{{ floor 1.2 }} -> 1", "description": "

Get the Math.floor() of the given value.

\n", - "isBlock": false + "requiresBlock": false }, "minus": { "args": [ @@ -64,7 +64,7 @@ "numArgs": 2, "example": "{{ subtract 10 5 }} -> 5", "description": "

Return the product of a minus b.

\n", - "isBlock": false + "requiresBlock": false }, "modulo": { "args": [ @@ -74,7 +74,7 @@ "numArgs": 2, "example": "{{ modulo 10 5 }} -> 0", "description": "

Get the remainder of a division operation.

\n", - "isBlock": false + "requiresBlock": false }, "multiply": { "args": [ @@ -84,7 +84,7 @@ "numArgs": 2, "example": "{{ multiply 10 5 }} -> 50", "description": "

Multiply number a by number b.

\n", - "isBlock": false + "requiresBlock": false }, "plus": { "args": [ @@ -94,7 +94,7 @@ "numArgs": 2, "example": "{{ plus 10 5 }} -> 15", "description": "

Add a by b.

\n", - "isBlock": false + "requiresBlock": false }, "random": { "args": [ @@ -104,7 +104,7 @@ "numArgs": 2, "example": "{{ random 0 20 }} -> 10", "description": "

Generate a random number between two values

\n", - "isBlock": false + "requiresBlock": false }, "remainder": { "args": [ @@ -114,7 +114,7 @@ "numArgs": 2, "example": "{{ remainder 10 6 }} -> 4", "description": "

Get the remainder when a is divided by b.

\n", - "isBlock": false + "requiresBlock": false }, "round": { "args": [ @@ -123,7 +123,7 @@ "numArgs": 1, "example": "{{ round 10.3 }} -> 10", "description": "

Round the given number.

\n", - "isBlock": false + "requiresBlock": false }, "subtract": { "args": [ @@ -133,7 +133,7 @@ "numArgs": 2, "example": "{{ subtract 10 5 }} -> 5", "description": "

Return the product of a minus b.

\n", - "isBlock": false + "requiresBlock": false }, "sum": { "args": [ @@ -142,7 +142,7 @@ "numArgs": 1, "example": "{{ sum [1, 2, 3] }} -> 6", "description": "

Returns the sum of all numbers in the given array.

\n", - "isBlock": false + "requiresBlock": false } }, "array": { @@ -154,7 +154,7 @@ "numArgs": 2, "example": "{{ after ['a', 'b', 'c', 'd'] 2}} -> ['c', 'd']", "description": "

Returns all of the items in an array after the specified index. Opposite of before.

\n", - "isBlock": false + "requiresBlock": false }, "arrayify": { "args": [ @@ -163,7 +163,7 @@ "numArgs": 1, "example": "{{ arrayify 'foo' }} -> ['foo']", "description": "

Cast the given value to an array.

\n", - "isBlock": false + "requiresBlock": false }, "before": { "args": [ @@ -173,7 +173,7 @@ "numArgs": 2, "example": "{{ before ['a', 'b', 'c', 'd'] 3}} -> ['a', 'b']", "description": "

Return all of the items in the collection before the specified count. Opposite of after.

\n", - "isBlock": false + "requiresBlock": false }, "eachIndex": { "args": [ @@ -183,7 +183,7 @@ "numArgs": 2, "example": "{{#eachIndex [1, 2, 3]}} {{item}} is {{index}} {{/eachIndex}} -> ' 1 is 0 2 is 1 3 is 2 '", "description": "

Iterates the array, listing an item and the index of it.

\n", - "isBlock": true + "requiresBlock": true }, "filter": { "args": [ @@ -194,7 +194,7 @@ "numArgs": 3, "example": "{{#filter [1, 2, 3] 2}}2 Found{{else}}2 not found{{/filter}} -> 2 Found", "description": "

Block helper that filters the given array and renders the block for values that evaluate to true, otherwise the inverse block is returned.

\n", - "isBlock": true + "requiresBlock": true }, "first": { "args": [ @@ -204,7 +204,7 @@ "numArgs": 2, "example": "{{first [1, 2, 3, 4] 2}} -> 1,2", "description": "

Returns the first item, or first n items of an array.

\n", - "isBlock": false + "requiresBlock": false }, "forEach": { "args": [ @@ -214,7 +214,7 @@ "numArgs": 2, "example": "{{#forEach [{ 'name': 'John' }] }} {{ name }} {{/forEach}} -> ' John '", "description": "

Iterates over each item in an array and exposes the current item in the array as context to the inner block. In addition to the current array item, the helper exposes the following variables to the inner block: - index - total - isFirst - isLast Also, @index is exposed as a private variable, and additional private variables may be defined as hash arguments.

\n", - "isBlock": true + "requiresBlock": true }, "inArray": { "args": [ @@ -225,7 +225,7 @@ "numArgs": 3, "example": "{{#inArray [1, 2, 3] 2}} 2 exists {{else}} 2 does not exist {{/inArray}} -> ' 2 exists '", "description": "

Block helper that renders the block if an array has the given value. Optionally specify an inverse block to render when the array does not have the given value.

\n", - "isBlock": true + "requiresBlock": true }, "isArray": { "args": [ @@ -234,7 +234,7 @@ "numArgs": 1, "example": "{{isArray [1, 2]}} -> true", "description": "

Returns true if value is an es5 array.

\n", - "isBlock": false + "requiresBlock": false }, "itemAt": { "args": [ @@ -244,7 +244,7 @@ "numArgs": 2, "example": "{{itemAt [1, 2, 3] 1}} -> 2", "description": "

Returns the item from array at index idx.

\n", - "isBlock": false + "requiresBlock": false }, "join": { "args": [ @@ -254,7 +254,7 @@ "numArgs": 2, "example": "{{join [1, 2, 3]}} -> 1, 2, 3", "description": "

Join all elements of array into a string, optionally using a given separator.

\n", - "isBlock": false + "requiresBlock": false }, "equalsLength": { "args": [ @@ -264,7 +264,7 @@ "numArgs": 2, "example": "{{equalsLength [1, 2, 3] 3}} -> true", "description": "

Returns true if the the length of the given value is equal to the given length. Can be used as a block or inline helper.

\n", - "isBlock": true + "requiresBlock": true }, "last": { "args": [ @@ -274,7 +274,7 @@ "numArgs": 2, "example": "{{last [1, 2, 3]}} -> 3", "description": "

Returns the last item, or last n items of an array or string. Opposite of first.

\n", - "isBlock": false + "requiresBlock": false }, "length": { "args": [ @@ -283,7 +283,7 @@ "numArgs": 1, "example": "{{length [1, 2, 3]}} -> 3", "description": "

Returns the length of the given string or array.

\n", - "isBlock": false + "requiresBlock": false }, "lengthEqual": { "args": [ @@ -293,7 +293,7 @@ "numArgs": 2, "example": "{{equalsLength [1, 2, 3] 3}} -> true", "description": "

Returns true if the the length of the given value is equal to the given length. Can be used as a block or inline helper.

\n", - "isBlock": true + "requiresBlock": true }, "map": { "args": [ @@ -303,7 +303,7 @@ "numArgs": 2, "example": "{{map [1, 2, 3] double}} -> [2, 4, 6]", "description": "

Returns a new array, created by calling function on each element of the given array. For example,

\n", - "isBlock": false + "requiresBlock": false }, "pluck": { "args": [ @@ -313,7 +313,7 @@ "numArgs": 2, "example": "{{pluck [{ 'name': 'Bob' }] 'name' }} -> ['Bob']", "description": "

Map over the given object or array or objects and create an array of values from the given prop. Dot-notation may be used (as a string) to get nested properties.

\n", - "isBlock": false + "requiresBlock": false }, "reverse": { "args": [ @@ -322,7 +322,7 @@ "numArgs": 1, "example": "{{reverse [1, 2, 3]}} -> [3, 2, 1]", "description": "

Reverse the elements in an array, or the characters in a string.

\n", - "isBlock": false + "requiresBlock": false }, "some": { "args": [ @@ -333,7 +333,7 @@ "numArgs": 3, "example": "{{#some [1, \"b\", 3] isString}} string found {{else}} No string found {{/some}} -> ' string found '", "description": "

Block helper that returns the block if the callback returns true for some value in the given array.

\n", - "isBlock": true + "requiresBlock": true }, "sort": { "args": [ @@ -343,7 +343,7 @@ "numArgs": 2, "example": "{{ sort ['b', 'a', 'c'] }} -> ['a', 'b', 'c']", "description": "

Sort the given array. If an array of objects is passed, you may optionally pass a key to sort on as the second argument. You may alternatively pass a sorting function as the second argument.

\n", - "isBlock": false + "requiresBlock": false }, "sortBy": { "args": [ @@ -353,7 +353,7 @@ "numArgs": 2, "example": "{{ sortBy [{'a': 'zzz'}, {'a': 'aaa'}] 'a' }} -> [{'a':'aaa'},{'a':'zzz'}]", "description": "

Sort an array. If an array of objects is passed, you may optionally pass a key to sort on as the second argument. You may alternatively pass a sorting function as the second argument.

\n", - "isBlock": false + "requiresBlock": false }, "withAfter": { "args": [ @@ -364,7 +364,7 @@ "numArgs": 3, "example": "{{#withAfter [1, 2, 3] 1 }} {{this}} {{/withAfter}} -> ' 2 3 '", "description": "

Use the items in the array after the specified index as context inside a block. Opposite of withBefore.

\n", - "isBlock": true + "requiresBlock": true }, "withBefore": { "args": [ @@ -375,7 +375,7 @@ "numArgs": 3, "example": "{{#withBefore [1, 2, 3] 2 }} {{this}} {{/withBefore}} -> ' 1 '", "description": "

Use the items in the array before the specified index as context inside a block. Opposite of withAfter.

\n", - "isBlock": true + "requiresBlock": true }, "withFirst": { "args": [ @@ -386,7 +386,7 @@ "numArgs": 3, "example": "{{#withFirst [1, 2, 3] }}{{this}}{{/withFirst}} -> 1", "description": "

Use the first item in a collection inside a handlebars block expression. Opposite of withLast.

\n", - "isBlock": true + "requiresBlock": true }, "withGroup": { "args": [ @@ -397,7 +397,7 @@ "numArgs": 3, "example": "{{#withGroup [1, 2, 3, 4] 2}}{{#each this}}{{.}}{{/each}}
{{/withGroup}} -> 12
34
", "description": "

Block helper that groups array elements by given group size.

\n", - "isBlock": true + "requiresBlock": true }, "withLast": { "args": [ @@ -408,7 +408,7 @@ "numArgs": 3, "example": "{{#withLast [1, 2, 3, 4]}}{{this}}{{/withLast}} -> 4", "description": "

Use the last item or n items in an array as context inside a block. Opposite of withFirst.

\n", - "isBlock": true + "requiresBlock": true }, "withSort": { "args": [ @@ -419,7 +419,7 @@ "numArgs": 3, "example": "{{#withSort ['b', 'a', 'c']}}{{this}}{{/withSort}} -> abc", "description": "

Block helper that sorts a collection and exposes the sorted collection as context inside the block.

\n", - "isBlock": true + "requiresBlock": true }, "unique": { "args": [ @@ -429,7 +429,7 @@ "numArgs": 2, "example": "{{#each (unique ['a', 'a', 'c', 'b', 'e', 'e']) }}{{.}}{{/each}} -> acbe", "description": "

Block helper that return an array with all duplicate values removed. Best used along with a each helper.

\n", - "isBlock": true + "requiresBlock": true } }, "number": { @@ -440,7 +440,7 @@ "numArgs": 1, "example": "{{ bytes 1386 1 }} -> 1.4 kB", "description": "

Format a number to it's equivalent in bytes. If a string is passed, it's length will be formatted and returned. Examples: - 'foo' => 3 B - 13661855 => 13.66 MB - 825399 => 825.39 kB - 1396 => 1.4 kB

\n", - "isBlock": false + "requiresBlock": false }, "addCommas": { "args": [ @@ -449,7 +449,7 @@ "numArgs": 1, "example": "{{ addCommas 1000000 }} -> 1,000,000", "description": "

Add commas to numbers

\n", - "isBlock": false + "requiresBlock": false }, "phoneNumber": { "args": [ @@ -458,7 +458,7 @@ "numArgs": 1, "example": "{{ phoneNumber 8005551212 }} -> (800) 555-1212", "description": "

Convert a string or number to a formatted phone number.

\n", - "isBlock": false + "requiresBlock": false }, "toAbbr": { "args": [ @@ -468,7 +468,7 @@ "numArgs": 2, "example": "{{ toAbbr 10123 2 }} -> 10.12k", "description": "

Abbreviate numbers to the given number of precision. This for general numbers, not size in bytes.

\n", - "isBlock": false + "requiresBlock": false }, "toExponential": { "args": [ @@ -478,7 +478,7 @@ "numArgs": 2, "example": "{{ toExponential 10123 2 }} -> 1.01e+4", "description": "

Returns a string representing the given number in exponential notation.

\n", - "isBlock": false + "requiresBlock": false }, "toFixed": { "args": [ @@ -488,7 +488,7 @@ "numArgs": 2, "example": "{{ toFixed 1.1234 2 }} -> 1.12", "description": "

Formats the given number using fixed-point notation.

\n", - "isBlock": false + "requiresBlock": false }, "toFloat": { "args": [ @@ -496,7 +496,7 @@ ], "numArgs": 1, "description": "

Convert input to a float.

\n", - "isBlock": false + "requiresBlock": false }, "toInt": { "args": [ @@ -504,7 +504,7 @@ ], "numArgs": 1, "description": "

Convert input to an integer.

\n", - "isBlock": false + "requiresBlock": false }, "toPrecision": { "args": [ @@ -514,7 +514,7 @@ "numArgs": 2, "example": "{{toPrecision '1.1234' 2}} -> 1.1", "description": "

Returns a string representing the Number object to the specified precision.

\n", - "isBlock": false + "requiresBlock": false } }, "url": { @@ -525,7 +525,7 @@ "numArgs": 1, "example": "{{ encodeURI 'https://myurl?Hello There' }} -> https%3A%2F%2Fmyurl%3FHello%20There", "description": "

Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.

\n", - "isBlock": false + "requiresBlock": false }, "escape": { "args": [ @@ -534,7 +534,7 @@ "numArgs": 1, "example": "{{ escape 'https://myurl?Hello+There' }} -> https%3A%2F%2Fmyurl%3FHello%2BThere", "description": "

Escape the given string by replacing characters with escape sequences. Useful for allowing the string to be used in a URL, etc.

\n", - "isBlock": false + "requiresBlock": false }, "decodeURI": { "args": [ @@ -543,7 +543,7 @@ "numArgs": 1, "example": "{{ decodeURI 'https://myurl?Hello%20There' }} -> https://myurl?Hello There", "description": "

Decode a Uniform Resource Identifier (URI) component.

\n", - "isBlock": false + "requiresBlock": false }, "urlResolve": { "args": [ @@ -553,7 +553,7 @@ "numArgs": 2, "example": "{{ urlResolve 'https://myurl' '/api/test' }} -> https://myurl/api/test", "description": "

Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag.

\n", - "isBlock": false + "requiresBlock": false }, "urlParse": { "args": [ @@ -562,7 +562,7 @@ "numArgs": 1, "example": "{{ urlParse 'https://myurl/api/test' }}", "description": "

Parses a url string into an object.

\n", - "isBlock": false + "requiresBlock": false }, "stripQuerystring": { "args": [ @@ -571,7 +571,7 @@ "numArgs": 1, "example": "{{ stripQuerystring 'https://myurl/api/test?foo=bar' }} -> 'https://myurl/api/test'", "description": "

Strip the query string from the given url.

\n", - "isBlock": false + "requiresBlock": false }, "stripProtocol": { "args": [ @@ -580,7 +580,7 @@ "numArgs": 1, "example": "{{ stripProtocol 'https://myurl/api/test' }} -> '//myurl/api/test'", "description": "

Strip protocol from a url. Useful for displaying media that may have an 'http' protocol on secure connections.

\n", - "isBlock": false + "requiresBlock": false } }, "string": { @@ -592,7 +592,7 @@ "numArgs": 2, "example": "{{append 'index' '.html'}} -> index.html", "description": "

Append the specified suffix to the given string.

\n", - "isBlock": false + "requiresBlock": false }, "camelcase": { "args": [ @@ -601,7 +601,7 @@ "numArgs": 1, "example": "{{camelcase 'foo bar baz'}} -> fooBarBaz", "description": "

camelCase the characters in the given string.

\n", - "isBlock": false + "requiresBlock": false }, "capitalize": { "args": [ @@ -610,7 +610,7 @@ "numArgs": 1, "example": "{{capitalize 'foo bar baz'}} -> Foo bar baz", "description": "

Capitalize the first word in a sentence.

\n", - "isBlock": false + "requiresBlock": false }, "capitalizeAll": { "args": [ @@ -619,7 +619,7 @@ "numArgs": 1, "example": "{{ capitalizeAll 'foo bar baz'}} -> Foo Bar Baz", "description": "

Capitalize all words in a string.

\n", - "isBlock": false + "requiresBlock": false }, "center": { "args": [ @@ -629,7 +629,7 @@ "numArgs": 2, "example": "{{ center 'test' 1}} -> ' test '", "description": "

Center a string using non-breaking spaces

\n", - "isBlock": false + "requiresBlock": false }, "chop": { "args": [ @@ -638,7 +638,7 @@ "numArgs": 1, "example": "{{ chop ' ABC '}} -> ABC", "description": "

Like trim, but removes both extraneous whitespace and non-word characters from the beginning and end of a string.

\n", - "isBlock": false + "requiresBlock": false }, "dashcase": { "args": [ @@ -647,7 +647,7 @@ "numArgs": 1, "example": "{{dashcase 'a-b-c d_e'}} -> a-b-c-d-e", "description": "

dash-case the characters in string. Replaces non-word characters and periods with hyphens.

\n", - "isBlock": false + "requiresBlock": false }, "dotcase": { "args": [ @@ -656,7 +656,7 @@ "numArgs": 1, "example": "{{dotcase 'a-b-c d_e'}} -> a.b.c.d.e", "description": "

dot.case the characters in string.

\n", - "isBlock": false + "requiresBlock": false }, "downcase": { "args": [ @@ -665,7 +665,7 @@ "numArgs": 1, "example": "{{downcase 'aBcDeF'}} -> abcdef", "description": "

Lowercase all of the characters in the given string. Alias for lowercase.

\n", - "isBlock": false + "requiresBlock": false }, "ellipsis": { "args": [ @@ -675,7 +675,7 @@ "numArgs": 2, "example": "{{ellipsis 'foo bar baz' 7}} -> foo bar…", "description": "

Truncates a string to the specified length, and appends it with an elipsis, .

\n", - "isBlock": false + "requiresBlock": false }, "hyphenate": { "args": [ @@ -684,7 +684,7 @@ "numArgs": 1, "example": "{{hyphenate 'foo bar baz qux'}} -> foo-bar-baz-qux", "description": "

Replace spaces in a string with hyphens.

\n", - "isBlock": false + "requiresBlock": false }, "isString": { "args": [ @@ -693,7 +693,7 @@ "numArgs": 1, "example": "{{isString 'foo'}} -> true", "description": "

Return true if value is a string.

\n", - "isBlock": false + "requiresBlock": false }, "lowercase": { "args": [ @@ -702,7 +702,7 @@ "numArgs": 1, "example": "{{lowercase 'Foo BAR baZ'}} -> foo bar baz", "description": "

Lowercase all characters in the given string.

\n", - "isBlock": false + "requiresBlock": false }, "occurrences": { "args": [ @@ -712,7 +712,7 @@ "numArgs": 2, "example": "{{occurrences 'foo bar foo bar baz' 'foo'}} -> 2", "description": "

Return the number of occurrences of substring within the given string.

\n", - "isBlock": false + "requiresBlock": false }, "pascalcase": { "args": [ @@ -721,7 +721,7 @@ "numArgs": 1, "example": "{{pascalcase 'foo bar baz'}} -> FooBarBaz", "description": "

PascalCase the characters in string.

\n", - "isBlock": false + "requiresBlock": false }, "pathcase": { "args": [ @@ -730,7 +730,7 @@ "numArgs": 1, "example": "{{pathcase 'a-b-c d_e'}} -> a/b/c/d/e", "description": "

path/case the characters in string.

\n", - "isBlock": false + "requiresBlock": false }, "plusify": { "args": [ @@ -739,7 +739,7 @@ "numArgs": 1, "example": "{{plusify 'foo bar baz'}} -> foo+bar+baz", "description": "

Replace spaces in the given string with pluses.

\n", - "isBlock": false + "requiresBlock": false }, "prepend": { "args": [ @@ -749,7 +749,7 @@ "numArgs": 2, "example": "{{prepend 'bar' 'foo-'}} -> foo-bar", "description": "

Prepends the given string with the specified prefix.

\n", - "isBlock": false + "requiresBlock": false }, "remove": { "args": [ @@ -759,7 +759,7 @@ "numArgs": 2, "example": "{{remove 'a b a b a b' 'a '}} -> b b b", "description": "

Remove all occurrences of substring from the given str.

\n", - "isBlock": false + "requiresBlock": false }, "removeFirst": { "args": [ @@ -769,7 +769,7 @@ "numArgs": 2, "example": "{{removeFirst 'a b a b a b' 'a'}} -> ' b a b a b'", "description": "

Remove the first occurrence of substring from the given str.

\n", - "isBlock": false + "requiresBlock": false }, "replace": { "args": [ @@ -780,7 +780,7 @@ "numArgs": 3, "example": "{{replace 'a b a b a b' 'a' 'z'}} -> z b z b z b", "description": "

Replace all occurrences of substring a with substring b.

\n", - "isBlock": false + "requiresBlock": false }, "replaceFirst": { "args": [ @@ -791,7 +791,7 @@ "numArgs": 3, "example": "{{replaceFirst 'a b a b a b' 'a' 'z'}} -> z b a b a b", "description": "

Replace the first occurrence of substring a with substring b.

\n", - "isBlock": false + "requiresBlock": false }, "sentence": { "args": [ @@ -800,7 +800,7 @@ "numArgs": 1, "example": "{{sentence 'hello world. goodbye world.'}} -> Hello world. Goodbye world.", "description": "

Sentence case the given string

\n", - "isBlock": false + "requiresBlock": false }, "snakecase": { "args": [ @@ -809,7 +809,7 @@ "numArgs": 1, "example": "{{snakecase 'a-b-c d_e'}} -> a_b_c_d_e", "description": "

snake_case the characters in the given string.

\n", - "isBlock": false + "requiresBlock": false }, "split": { "args": [ @@ -818,7 +818,7 @@ "numArgs": 1, "example": "{{split 'a,b,c'}} -> ['a', 'b', 'c']", "description": "

Split string by the given character.

\n", - "isBlock": false + "requiresBlock": false }, "startsWith": { "args": [ @@ -829,7 +829,7 @@ "numArgs": 3, "example": "{{#startsWith 'Goodbye' 'Hello, world!'}}Yep{{else}}Nope{{/startsWith}} -> Nope", "description": "

Tests whether a string begins with the given prefix.

\n", - "isBlock": true + "requiresBlock": true }, "titleize": { "args": [ @@ -838,7 +838,7 @@ "numArgs": 1, "example": "{{titleize 'this is title case' }} -> This Is Title Case", "description": "

Title case the given string.

\n", - "isBlock": false + "requiresBlock": false }, "trim": { "args": [ @@ -847,7 +847,7 @@ "numArgs": 1, "example": "{{trim ' ABC ' }} -> ABC", "description": "

Removes extraneous whitespace from the beginning and end of a string.

\n", - "isBlock": false + "requiresBlock": false }, "trimLeft": { "args": [ @@ -856,7 +856,7 @@ "numArgs": 1, "example": "{{trimLeft ' ABC ' }} -> 'ABC '", "description": "

Removes extraneous whitespace from the beginning of a string.

\n", - "isBlock": false + "requiresBlock": false }, "trimRight": { "args": [ @@ -865,7 +865,7 @@ "numArgs": 1, "example": "{{trimRight ' ABC ' }} -> ' ABC'", "description": "

Removes extraneous whitespace from the end of a string.

\n", - "isBlock": false + "requiresBlock": false }, "truncate": { "args": [ @@ -876,7 +876,7 @@ "numArgs": 3, "example": "{{truncate 'foo bar baz' 7 }} -> foo bar", "description": "

Truncate a string to the specified length. Also see ellipsis.

\n", - "isBlock": false + "requiresBlock": false }, "truncateWords": { "args": [ @@ -887,7 +887,7 @@ "numArgs": 3, "example": "{{truncateWords 'foo bar baz' 1 }} -> foo…", "description": "

Truncate a string to have the specified number of words. Also see truncate.

\n", - "isBlock": false + "requiresBlock": false }, "upcase": { "args": [ @@ -896,7 +896,7 @@ "numArgs": 1, "example": "{{upcase 'aBcDef'}} -> ABCDEF", "description": "

Uppercase all of the characters in the given string. Alias for uppercase.

\n", - "isBlock": false + "requiresBlock": false }, "uppercase": { "args": [ @@ -906,7 +906,7 @@ "numArgs": 2, "example": "{{uppercase 'aBcDef'}} -> ABCDEF", "description": "

Uppercase all of the characters in the given string. If used as a block helper it will uppercase the entire block. This helper does not support inverse blocks.

\n", - "isBlock": true + "requiresBlock": true } }, "comparison": { @@ -919,7 +919,7 @@ "numArgs": 3, "example": "{{#and great magnificent}}both{{else}}no{{/and}} -> no", "description": "

Helper that renders the block if both of the given values are truthy. If an inverse block is specified it will be rendered when falsy. Works as a block helper, inline helper or subexpression.

\n", - "isBlock": true + "requiresBlock": true }, "compare": { "args": [ @@ -931,7 +931,7 @@ "numArgs": 4, "example": "{{compare 10 '<' 5 }} -> false", "description": "

Render a block when a comparison of the first and third arguments returns true. The second argument is the [arithemetic operator][operators] to use. You may also optionally specify an inverse block to render when falsy.

\n", - "isBlock": true + "requiresBlock": true }, "contains": { "args": [ @@ -943,7 +943,7 @@ "numArgs": 4, "example": "{{#contains ['a', 'b', 'c'] 'd'}} This will not be rendered. {{else}} This will be rendered. {{/contains}} -> ' This will be rendered. '", "description": "

Block helper that renders the block if collection has the given value, using strict equality (===) for comparison, otherwise the inverse block is rendered (if specified). If a startIndex is specified and is negative, it is used as the offset from the end of the collection.

\n", - "isBlock": true + "requiresBlock": true }, "default": { "args": [ @@ -953,7 +953,7 @@ "numArgs": 2, "example": "{{default null null 'default'}} -> default", "description": "

Returns the first value that is not undefined, otherwise the 'default' value is returned.

\n", - "isBlock": false + "requiresBlock": false }, "eq": { "args": [ @@ -964,7 +964,7 @@ "numArgs": 3, "example": "{{#eq 3 3}}equal{{else}}not equal{{/eq}} -> equal", "description": "

Block helper that renders a block if a is equal to b. If an inverse block is specified it will be rendered when falsy. You may optionally use the compare='' hash argument for the second value.

\n", - "isBlock": true + "requiresBlock": true }, "gt": { "args": [ @@ -975,7 +975,7 @@ "numArgs": 3, "example": "{{#gt 4 3}} greater than{{else}} not greater than{{/gt}} -> ' greater than'", "description": "

Block helper that renders a block if a is greater than b. If an inverse block is specified it will be rendered when falsy. You may optionally use the compare='' hash argument for the second value.

\n", - "isBlock": true + "requiresBlock": true }, "gte": { "args": [ @@ -986,7 +986,7 @@ "numArgs": 3, "example": "{{#gte 4 3}} greater than or equal{{else}} not greater than{{/gte}} -> ' greater than or equal'", "description": "

Block helper that renders a block if a is greater than or equal to b. If an inverse block is specified it will be rendered when falsy. You may optionally use the compare='' hash argument for the second value.

\n", - "isBlock": true + "requiresBlock": true }, "has": { "args": [ @@ -997,7 +997,7 @@ "numArgs": 3, "example": "{{#has 'foobar' 'foo'}}has it{{else}}doesn't{{/has}} -> has it", "description": "

Block helper that renders a block if value has pattern. If an inverse block is specified it will be rendered when falsy.

\n", - "isBlock": true + "requiresBlock": true }, "isFalsey": { "args": [ @@ -1007,7 +1007,7 @@ "numArgs": 2, "example": "{{isFalsey '' }} -> true", "description": "

Returns true if the given value is falsey. Uses the [falsey][] library for comparisons. Please see that library for more information or to report bugs with this helper.

\n", - "isBlock": false + "requiresBlock": false }, "isTruthy": { "args": [ @@ -1017,7 +1017,7 @@ "numArgs": 2, "example": "{{isTruthy '12' }} -> true", "description": "

Returns true if the given value is truthy. Uses the [falsey][] library for comparisons. Please see that library for more information or to report bugs with this helper.

\n", - "isBlock": false + "requiresBlock": false }, "ifEven": { "args": [ @@ -1027,7 +1027,7 @@ "numArgs": 2, "example": "{{#ifEven 2}} even {{else}} odd {{/ifEven}} -> ' even '", "description": "

Return true if the given value is an even number.

\n", - "isBlock": true + "requiresBlock": true }, "ifNth": { "args": [ @@ -1038,7 +1038,7 @@ "numArgs": 3, "example": "{{#ifNth 2 10}}remainder{{else}}no remainder{{/ifNth}} -> remainder", "description": "

Conditionally renders a block if the remainder is zero when b operand is divided by a. If an inverse block is specified it will be rendered when the remainder is not zero.

\n", - "isBlock": true + "requiresBlock": true }, "ifOdd": { "args": [ @@ -1048,7 +1048,7 @@ "numArgs": 2, "example": "{{#ifOdd 3}}odd{{else}}even{{/ifOdd}} -> odd", "description": "

Block helper that renders a block if value is an odd number. If an inverse block is specified it will be rendered when falsy.

\n", - "isBlock": true + "requiresBlock": true }, "is": { "args": [ @@ -1059,7 +1059,7 @@ "numArgs": 3, "example": "{{#is 3 3}} is {{else}} is not {{/is}} -> ' is '", "description": "

Block helper that renders a block if a is equal to b. If an inverse block is specified it will be rendered when falsy. Similar to eq but does not do strict equality.

\n", - "isBlock": true + "requiresBlock": true }, "isnt": { "args": [ @@ -1070,7 +1070,7 @@ "numArgs": 3, "example": "{{#isnt 3 3}} isnt {{else}} is {{/isnt}} -> ' is '", "description": "

Block helper that renders a block if a is not equal to b. If an inverse block is specified it will be rendered when falsy. Similar to unlessEq but does not use strict equality for comparisons.

\n", - "isBlock": true + "requiresBlock": true }, "lt": { "args": [ @@ -1080,7 +1080,7 @@ "numArgs": 2, "example": "{{#lt 2 3}} less than {{else}} more than or equal {{/lt}} -> ' less than '", "description": "

Block helper that renders a block if a is less than b. If an inverse block is specified it will be rendered when falsy. You may optionally use the compare='' hash argument for the second value.

\n", - "isBlock": true + "requiresBlock": true }, "lte": { "args": [ @@ -1091,7 +1091,7 @@ "numArgs": 3, "example": "{{#lte 2 3}} less than or equal {{else}} more than {{/lte}} -> ' less than or equal '", "description": "

Block helper that renders a block if a is less than or equal to b. If an inverse block is specified it will be rendered when falsy. You may optionally use the compare='' hash argument for the second value.

\n", - "isBlock": true + "requiresBlock": true }, "neither": { "args": [ @@ -1102,7 +1102,7 @@ "numArgs": 3, "example": "{{#neither null null}}both falsey{{else}}both not falsey{{/neither}} -> both falsey", "description": "

Block helper that renders a block if neither of the given values are truthy. If an inverse block is specified it will be rendered when falsy.

\n", - "isBlock": true + "requiresBlock": true }, "not": { "args": [ @@ -1112,7 +1112,7 @@ "numArgs": 2, "example": "{{#not undefined }}falsey{{else}}not falsey{{/not}} -> falsey", "description": "

Returns true if val is falsey. Works as a block or inline helper.

\n", - "isBlock": true + "requiresBlock": true }, "or": { "args": [ @@ -1122,7 +1122,7 @@ "numArgs": 2, "example": "{{#or 1 2 undefined }} at least one truthy {{else}} all falsey {{/or}} -> ' at least one truthy '", "description": "

Block helper that renders a block if any of the given values is truthy. If an inverse block is specified it will be rendered when falsy.

\n", - "isBlock": true + "requiresBlock": true }, "unlessEq": { "args": [ @@ -1133,7 +1133,7 @@ "numArgs": 3, "example": "{{#unlessEq 2 1 }} not equal {{else}} equal {{/unlessEq}} -> ' not equal '", "description": "

Block helper that always renders the inverse block unless a is equal to b.

\n", - "isBlock": true + "requiresBlock": true }, "unlessGt": { "args": [ @@ -1144,7 +1144,7 @@ "numArgs": 3, "example": "{{#unlessGt 20 1 }} not greater than {{else}} greater than {{/unlessGt}} -> ' greater than '", "description": "

Block helper that always renders the inverse block unless a is greater than b.

\n", - "isBlock": true + "requiresBlock": true }, "unlessLt": { "args": [ @@ -1155,7 +1155,7 @@ "numArgs": 3, "example": "{{#unlessLt 20 1 }}greater than or equal{{else}}less than{{/unlessLt}} -> greater than or equal", "description": "

Block helper that always renders the inverse block unless a is less than b.

\n", - "isBlock": true + "requiresBlock": true }, "unlessGteq": { "args": [ @@ -1166,7 +1166,7 @@ "numArgs": 3, "example": "{{#unlessGteq 20 1 }} less than {{else}}greater than or equal to{{/unlessGteq}} -> greater than or equal to", "description": "

Block helper that always renders the inverse block unless a is greater than or equal to b.

\n", - "isBlock": true + "requiresBlock": true }, "unlessLteq": { "args": [ @@ -1177,7 +1177,7 @@ "numArgs": 3, "example": "{{#unlessLteq 20 1 }} greater than {{else}} less than or equal to {{/unlessLteq}} -> ' greater than '", "description": "

Block helper that always renders the inverse block unless a is less than or equal to b.

\n", - "isBlock": true + "requiresBlock": true } }, "object": { @@ -1187,7 +1187,7 @@ ], "numArgs": 1, "description": "

Extend the context with the properties of other objects. A shallow merge is performed to avoid mutating the context.

\n", - "isBlock": false + "requiresBlock": false }, "forIn": { "args": [ @@ -1196,7 +1196,7 @@ ], "numArgs": 2, "description": "

Block helper that iterates over the properties of an object, exposing each key and value on the context.

\n", - "isBlock": true + "requiresBlock": true }, "forOwn": { "args": [ @@ -1205,7 +1205,7 @@ ], "numArgs": 2, "description": "

Block helper that iterates over the own properties of an object, exposing each key and value on the context.

\n", - "isBlock": true + "requiresBlock": true }, "toPath": { "args": [ @@ -1213,7 +1213,7 @@ ], "numArgs": 1, "description": "

Take arguments and, if they are string or number, convert them to a dot-delineated object property path.

\n", - "isBlock": false + "requiresBlock": false }, "get": { "args": [ @@ -1223,7 +1223,7 @@ ], "numArgs": 3, "description": "

Use property paths (a.b.c) to get a value or nested value from the context. Works as a regular helper or block helper.

\n", - "isBlock": true + "requiresBlock": true }, "getObject": { "args": [ @@ -1232,7 +1232,7 @@ ], "numArgs": 2, "description": "

Use property paths (a.b.c) to get an object from the context. Differs from the get helper in that this helper will return the actual object, including the given property key. Also, this helper does not work as a block helper.

\n", - "isBlock": false + "requiresBlock": false }, "hasOwn": { "args": [ @@ -1241,7 +1241,7 @@ ], "numArgs": 2, "description": "

Return true if key is an own, enumerable property of the given context object.

\n", - "isBlock": false + "requiresBlock": false }, "isObject": { "args": [ @@ -1249,7 +1249,7 @@ ], "numArgs": 1, "description": "

Return true if value is an object.

\n", - "isBlock": false + "requiresBlock": false }, "JSONparse": { "args": [ @@ -1257,7 +1257,7 @@ ], "numArgs": 1, "description": "

Parses the given string using JSON.parse.

\n", - "isBlock": true + "requiresBlock": true }, "JSONstringify": { "args": [ @@ -1265,7 +1265,7 @@ ], "numArgs": 1, "description": "

Stringify an object using JSON.stringify.

\n", - "isBlock": false + "requiresBlock": false }, "merge": { "args": [ @@ -1274,7 +1274,7 @@ ], "numArgs": 2, "description": "

Deeply merge the properties of the given objects with the context object.

\n", - "isBlock": false + "requiresBlock": false }, "parseJSON": { "args": [ @@ -1282,7 +1282,7 @@ ], "numArgs": 1, "description": "

Parses the given string using JSON.parse.

\n", - "isBlock": true + "requiresBlock": true }, "pick": { "args": [ @@ -1292,7 +1292,7 @@ ], "numArgs": 3, "description": "

Pick properties from the context object.

\n", - "isBlock": true + "requiresBlock": true }, "stringify": { "args": [ @@ -1300,7 +1300,7 @@ ], "numArgs": 1, "description": "

Stringify an object using JSON.stringify.

\n", - "isBlock": false + "requiresBlock": false } }, "uuid": { @@ -1309,7 +1309,7 @@ "numArgs": 0, "example": "{{ uuid }} -> f34ebc66-93bd-4f7c-b79b-92b5569138bc", "description": "

Generates a UUID, using the V4 method (identical to the browser crypto.randomUUID function).

\n", - "isBlock": false + "requiresBlock": false } }, "date": { diff --git a/packages/string-templates/scripts/gen-collection-info.js b/packages/string-templates/scripts/gen-collection-info.js index 48bf503ade..1b540c829c 100644 --- a/packages/string-templates/scripts/gen-collection-info.js +++ b/packages/string-templates/scripts/gen-collection-info.js @@ -115,7 +115,7 @@ function getCommentInfo(file, func) { docs.example = docs.example.replace("product", "multiply") } docs.description = blocks[0].trim() - docs.isBlock = docs.tags.some(el => el.title === "block") + docs.requiresBlock = docs.tags.some(el => el.title === "block") return docs } @@ -160,7 +160,7 @@ function run() { numArgs: args.length, example: jsDocInfo.example || undefined, description: jsDocInfo.description, - isBlock: jsDocInfo.isBlock, + requiresBlock: jsDocInfo.requiresBlock, }) } outputJSON[collection] = collectionInfo diff --git a/packages/string-templates/test/manifest.spec.js b/packages/string-templates/test/manifest.spec.js index 762726e2f3..01fb088bbc 100644 --- a/packages/string-templates/test/manifest.spec.js +++ b/packages/string-templates/test/manifest.spec.js @@ -58,8 +58,8 @@ const examples = collections.reduce((acc, collection) => { } } } - const hasHbsBody = details.isBlock - return [name, { hbs, js, hasHbsBody }] + const requiresHbsBody = details.requiresBlock + return [name, { hbs, js, requiresHbsBody }] }) .filter(x => !!x) @@ -110,7 +110,9 @@ describe("manifest", () => { describe("can be parsed and run as js", () => { describe.each(Object.keys(examples))("%s", collection => { it.each( - examples[collection].filter(([_, { hasHbsBody }]) => !hasHbsBody) + examples[collection].filter( + ([_, { requiresHbsBody }]) => !requiresHbsBody + ) )("%s", async (_, { hbs, js }) => { const context = { double: i => i * 2,