@jaredwray/fumanchu 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -44
- package/index.d.ts +2 -15
- package/lib/math.js +0 -3
- package/lib/path.js +9 -0
- package/lib/regex.js +1 -1
- package/lib/string.js +6 -6
- package/package.json +29 -43
- package/dist/fumanchu.min.js +0 -3697
- package/dist/fumanchu.min.js.map +0 -1
package/README.md
CHANGED
|
@@ -13,7 +13,6 @@ Handlebars + Helpers Together
|
|
|
13
13
|
|
|
14
14
|
## Table of Contents
|
|
15
15
|
* [Using in Nodejs](#using-in-nodejs)
|
|
16
|
-
* [Using in Browser](#using-in-browser)
|
|
17
16
|
* [Helpers](#helpers)
|
|
18
17
|
* [How to Contribute](#how-to-contribute)
|
|
19
18
|
* [License and Copyright](#license-and-copyright)
|
|
@@ -21,11 +20,13 @@ Handlebars + Helpers Together
|
|
|
21
20
|
## Usage Nodejs
|
|
22
21
|
|
|
23
22
|
```bash
|
|
24
|
-
npm install @jaredwray/fumanchu
|
|
23
|
+
npm install @jaredwray/fumanchu --save
|
|
24
|
+
// or
|
|
25
|
+
yarn add @jaredwray/fumanchu
|
|
25
26
|
```
|
|
26
27
|
|
|
27
28
|
```javascript
|
|
28
|
-
var handlebars = require('fumanchu');
|
|
29
|
+
var handlebars = require('@jaredwray/fumanchu');
|
|
29
30
|
var template = handlebars.compile('{{#if (eq foo "bar")}}<p>Foo is bar</p>{{/if}}');
|
|
30
31
|
var html = template({foo: 'bar'});
|
|
31
32
|
console.log(html);
|
|
@@ -33,17 +34,6 @@ console.log(html);
|
|
|
33
34
|
|
|
34
35
|
It's just that easy! No need to add Handlebars to your project, it's already included.
|
|
35
36
|
|
|
36
|
-
## Usage Browser - NOT WORKING YET
|
|
37
|
-
|
|
38
|
-
```html
|
|
39
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/fumanchu/1.0.0/fumanchu.min.js"></script>
|
|
40
|
-
<script>
|
|
41
|
-
var template = fumanchu.compile('{{#if (eq foo "bar")}}<p>Foo is bar</p>{{/if}}');
|
|
42
|
-
var html = template({foo: 'bar'});
|
|
43
|
-
console.log(html);
|
|
44
|
-
</script>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
37
|
## Helpers
|
|
48
38
|
More than 180 Handlebars helpers in ~20 categories. Helpers can be used with Assemble, Generate, Verb, Ghost, gulp-handlebars, grunt-handlebars, consolidate, or any node.js/Handlebars project.
|
|
49
39
|
|
|
@@ -89,13 +79,13 @@ Visit the: [code](lib/array.js) | [unit tests](test/array.js) | [issues](https:/
|
|
|
89
79
|
* **[isArray](#isArray)** ([code](lib/array.js#L244) | [tests](test/array.js#L172))
|
|
90
80
|
* **[itemAt](#itemAt)** ([code](lib/array.js#L263) | [tests](test/array.js#L182))
|
|
91
81
|
* **[join](#join)** ([code](lib/array.js#L294) | [tests](test/array.js#L225))
|
|
92
|
-
* **[equalsLength](#equalsLength)** ([code](lib/array.js#L313) | [
|
|
82
|
+
* **[equalsLength](#equalsLength)** ([code](lib/array.js#L313) | [tests](test/array.js#L494))
|
|
93
83
|
* **[last](#last)** ([code](lib/array.js#L349) | [tests](test/array.js#L240))
|
|
94
84
|
* **[length](#length)** ([code](lib/array.js#L379) | [tests](test/array.js#L254))
|
|
95
85
|
* **[lengthEqual](#lengthEqual)** ([code](lib/array.js#L395) | [tests](test/array.js#L254))
|
|
96
86
|
* **[map](#map)** ([code](lib/array.js#L414) | [tests](test/array.js#L266))
|
|
97
87
|
* **[pluck](#pluck)** ([code](lib/array.js#L445) | [tests](test/array.js#L300))
|
|
98
|
-
* **[reverse](#reverse)** ([code](lib/array.js#L473) | [
|
|
88
|
+
* **[reverse](#reverse)** ([code](lib/array.js#L473) | [tests](test/array.js#L506))
|
|
99
89
|
* **[some](#some)** ([code](lib/array.js#L504) | [tests](test/array.js#L308))
|
|
100
90
|
* **[sort](#sort)** ([code](lib/array.js#L532) | [tests](test/array.js#L333))
|
|
101
91
|
* **[sortBy](#sortBy)** ([code](lib/array.js#L557) | [tests](test/array.js#L358))
|
|
@@ -144,7 +134,7 @@ Visit the: [code](lib/comparison.js) | [unit tests](test/comparison.js) | [issue
|
|
|
144
134
|
* **[lt](#lt)** ([code](lib/comparison.js#L411) | [tests](test/comparison.js#L449))
|
|
145
135
|
* **[lte](#lte)** ([code](lib/comparison.js#L435) | [tests](test/comparison.js#L476))
|
|
146
136
|
* **[neither](#neither)** ([code](lib/comparison.js#L456) | [tests](test/comparison.js#L511))
|
|
147
|
-
* **[not](#not)** ([code](lib/comparison.js#L470) | [
|
|
137
|
+
* **[not](#not)** ([code](lib/comparison.js#L470) | [tests](test/comparison.js#L624))
|
|
148
138
|
* **[or](#or)** ([code](lib/comparison.js#L492) | [tests](test/comparison.js#L523))
|
|
149
139
|
* **[unlessEq](#unlessEq)** ([code](lib/comparison.js#L518) | [tests](test/comparison.js#L556))
|
|
150
140
|
* **[unlessGt](#unlessGt)** ([code](lib/comparison.js#L538) | [tests](test/comparison.js#L567))
|
|
@@ -222,37 +212,37 @@ Visit the: [code](lib/match.js) | [unit tests](test/match.js) | [issues](https:/
|
|
|
222
212
|
|
|
223
213
|
* **[match](#match)** ([code](lib/match.js#L23) | [tests](test/match.js#L13))
|
|
224
214
|
* **[isMatch](#isMatch)** ([code](lib/match.js#L47) | [tests](test/match.js#L61))
|
|
225
|
-
* **[mm](#mm)** ([code](lib/match.js#L56) | [
|
|
215
|
+
* **[mm](#mm)** ([code](lib/match.js#L56) | [tests](test/match.js#L67))
|
|
226
216
|
|
|
227
217
|
### [math helpers](#math)
|
|
228
218
|
|
|
229
219
|
Visit the: [code](lib/math.js) | [unit tests](test/math.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+math+helpers))
|
|
230
220
|
|
|
231
|
-
* **[abs](#abs)** ([code](lib/math.js#L15) | [
|
|
221
|
+
* **[abs](#abs)** ([code](lib/math.js#L15) | [test](test/math.js#L149))
|
|
232
222
|
* **[add](#add)** ([code](lib/math.js#L31) | [tests](test/math.js#L10))
|
|
233
|
-
* **[avg](#avg)** ([code](lib/math.js#L54) | [
|
|
223
|
+
* **[avg](#avg)** ([code](lib/math.js#L54) | [tests](test/math.js#L25))
|
|
234
224
|
* **[ceil](#ceil)** ([code](lib/math.js#L69) | [tests](test/math.js#L29))
|
|
235
225
|
* **[divide](#divide)** ([code](lib/math.js#L84) | [tests](test/math.js#L36))
|
|
236
226
|
* **[floor](#floor)** ([code](lib/math.js#L102) | [tests](test/math.js#L43))
|
|
237
|
-
* **[minus](#minus)** ([code](lib/math.js#L118) | [
|
|
238
|
-
* **[modulo](#modulo)** ([code](lib/math.js#L137) | [
|
|
227
|
+
* **[minus](#minus)** ([code](lib/math.js#L118) | [tests](test/math.js#L169))
|
|
228
|
+
* **[modulo](#modulo)** ([code](lib/math.js#L137) | [tests](test/math.js#L191))
|
|
239
229
|
* **[multiply](#multiply)** ([code](lib/math.js#L157) | [tests](test/math.js#L50))
|
|
240
|
-
* **[plus](#plus)** ([code](lib/math.js#L175) | [
|
|
230
|
+
* **[plus](#plus)** ([code](lib/math.js#L175) | [tests](test/math.js#L231))
|
|
241
231
|
* **[random](#random)** ([code](lib/math.js#L194) | [tests](test/math.js#L102))
|
|
242
232
|
* **[remainder](#remainder)** ([code](lib/math.js#L212) | [tests](test/math.js#L57))
|
|
243
233
|
* **[round](#round)** ([code](lib/math.js#L224) | [tests](test/math.js#L69))
|
|
244
234
|
* **[subtract](#subtract)** ([code](lib/math.js#L241) | [tests](test/math.js#L76))
|
|
245
235
|
* **[sum](#sum)** ([code](lib/math.js#L263) | [tests](test/math.js#L83))
|
|
246
|
-
* **[times](#times)** ([code](lib/math.js#L286) | [
|
|
236
|
+
* **[times](#times)** ([code](lib/math.js#L286) | [tests](test/math.js#L299))
|
|
247
237
|
|
|
248
238
|
### [misc helpers](#misc)
|
|
249
239
|
|
|
250
240
|
Visit the: [code](lib/misc.js) | [unit tests](test/misc.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+misc+helpers))
|
|
251
241
|
|
|
252
|
-
* **[frame](#frame)** ([code](lib/misc.js#L11) | [
|
|
242
|
+
* **[frame](#frame)** ([code](lib/misc.js#L11) | [tests](test/misc.js#L1))
|
|
253
243
|
* **[option](#option)** ([code](lib/misc.js#L26) | [tests](test/misc.js#L20))
|
|
254
244
|
* **[noop](#noop)** ([code](lib/misc.js#L39) | [tests](test/misc.js#L13))
|
|
255
|
-
* **[typeOf](#typeOf)** ([code](lib/misc.js#L59) | [
|
|
245
|
+
* **[typeOf](#typeOf)** ([code](lib/misc.js#L59) | [tests](test/misc.js#L38))
|
|
256
246
|
* **[withHash](#withHash)** ([code](lib/misc.js#L71) | [tests](test/misc.js#L38))
|
|
257
247
|
|
|
258
248
|
### [number helpers](#number)
|
|
@@ -298,21 +288,21 @@ Visit the: [code](lib/path.js) | [unit tests](test/path.js) | [issues](https://g
|
|
|
298
288
|
* **[basename](#basename)** ([code](lib/path.js#L81) | [tests](test/path.js#L47))
|
|
299
289
|
* **[stem](#stem)** ([code](lib/path.js#L100) | [tests](test/path.js#L58))
|
|
300
290
|
* **[extname](#extname)** ([code](lib/path.js#L119) | [tests](test/path.js#L69))
|
|
301
|
-
* **[resolve](#resolve)** ([code](lib/path.js#L138) | [
|
|
291
|
+
* **[resolve](#resolve)** ([code](lib/path.js#L138) | [tests](test/path.js#L145))
|
|
302
292
|
* **[segments](#segments)** ([code](lib/path.js#L166) | [tests](test/path.js#L80))
|
|
303
293
|
|
|
304
294
|
### [regex helpers](#regex)
|
|
305
295
|
|
|
306
296
|
Visit the: [code](lib/regex.js) | [unit tests](test/regex.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+regex+helpers))
|
|
307
297
|
|
|
308
|
-
* **[toRegex](#toRegex)** ([code](lib/regex.js#L19) | [
|
|
309
|
-
* **[test](#test)** ([code](lib/regex.js#L42) | [
|
|
298
|
+
* **[toRegex](#toRegex)** ([code](lib/regex.js#L19) | [tests](test/regex.js#10))
|
|
299
|
+
* **[test](#test)** ([code](lib/regex.js#L42) | [tests](test/regex.js#15))
|
|
310
300
|
|
|
311
301
|
### [string helpers](#string)
|
|
312
302
|
|
|
313
303
|
Visit the: [code](lib/string.js) | [unit tests](test/string.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+string+helpers))
|
|
314
304
|
|
|
315
|
-
* **[append](#append)** ([code](lib/string.js#L22) | [
|
|
305
|
+
* **[append](#append)** ([code](lib/string.js#L22) | [tests](test/string.js#L9))
|
|
316
306
|
* **[camelcase](#camelcase)** ([code](lib/string.js#L41) | [tests](test/string.js#L10))
|
|
317
307
|
* **[capitalize](#capitalize)** ([code](lib/string.js#L60) | [tests](test/string.js#L25))
|
|
318
308
|
* **[capitalizeAll](#capitalizeAll)** ([code](lib/string.js#L77) | [tests](test/string.js#L36))
|
|
@@ -320,7 +310,7 @@ Visit the: [code](lib/string.js) | [unit tests](test/string.js) | [issues](https
|
|
|
320
310
|
* **[chop](#chop)** ([code](lib/string.js#L125) | [tests](test/string.js#L58))
|
|
321
311
|
* **[dashcase](#dashcase)** ([code](lib/string.js#L143) | [tests](test/string.js#L73))
|
|
322
312
|
* **[dotcase](#dotcase)** ([code](lib/string.js#L162) | [tests](test/string.js#L88))
|
|
323
|
-
* **[downcase](#downcase)** ([code](lib/string.js#L182) | [
|
|
313
|
+
* **[downcase](#downcase)** ([code](lib/string.js#L182) | [tests](test/string.js#L391))
|
|
324
314
|
* **[ellipsis](#ellipsis)** ([code](lib/string.js#L202) | [tests](test/string.js#L103))
|
|
325
315
|
* **[hyphenate](#hyphenate)** ([code](lib/string.js#L223) | [tests](test/string.js#L118))
|
|
326
316
|
* **[isString](#isString)** ([code](lib/string.js#L240) | [tests](test/string.js#L129))
|
|
@@ -329,12 +319,12 @@ Visit the: [code](lib/string.js) | [unit tests](test/string.js) | [issues](https
|
|
|
329
319
|
* **[pascalcase](#pascalcase)** ([code](lib/string.js#L303) | [tests](test/string.js#L173))
|
|
330
320
|
* **[pathcase](#pathcase)** ([code](lib/string.js#L323) | [tests](test/string.js#L188))
|
|
331
321
|
* **[plusify](#plusify)** ([code](lib/string.js#L343) | [tests](test/string.js#L203))
|
|
332
|
-
* **[prepend](#prepend)** ([code](lib/string.js#L363) | [
|
|
333
|
-
* **[raw](#raw)** ([code](lib/string.js#L385) | [
|
|
334
|
-
* **[remove](#remove)** ([code](lib/string.js#L413) | [
|
|
335
|
-
* **[removeFirst](#removeFirst)** ([code](lib/string.js#L432) | [
|
|
322
|
+
* **[prepend](#prepend)** ([code](lib/string.js#L363) | [tests](test/string.js#L409))
|
|
323
|
+
* **[raw](#raw)** ([code](lib/string.js#L385) | [tests](test/string.js#L465))
|
|
324
|
+
* **[remove](#remove)** ([code](lib/string.js#L413) | [tests](test/string.js#L416)
|
|
325
|
+
* **[removeFirst](#removeFirst)** ([code](lib/string.js#L432) | [tests](test/string.js#L422))
|
|
336
326
|
* **[replace](#replace)** ([code](lib/string.js#L452) | [tests](test/string.js#L222))
|
|
337
|
-
* **[replaceFirst](#replaceFirst)** ([code](lib/string.js#L473) | [
|
|
327
|
+
* **[replaceFirst](#replaceFirst)** ([code](lib/string.js#L473) | [tests](test/string.js#L428))
|
|
338
328
|
* **[reverse](#reverse)** ([code](lib/string.js#L492) | [tests](test/string.js#L241))
|
|
339
329
|
* **[sentence](#sentence)** ([code](lib/string.js#L509) | [tests](test/string.js#L252))
|
|
340
330
|
* **[snakecase](#snakecase)** ([code](lib/string.js#L528) | [tests](test/string.js#L263))
|
|
@@ -342,11 +332,11 @@ Visit the: [code](lib/string.js) | [unit tests](test/string.js) | [issues](https
|
|
|
342
332
|
* **[startsWith](#startsWith)** ([code](lib/string.js#L572) | [tests](test/string.js#L293))
|
|
343
333
|
* **[titleize](#titleize)** ([code](lib/string.js#L596) | [tests](test/string.js#L312))
|
|
344
334
|
* **[trim](#trim)** ([code](lib/string.js#L623) | [tests](test/string.js#L323))
|
|
345
|
-
* **[trimLeft](#trimLeft)** ([code](lib/string.js#L639) | [
|
|
346
|
-
* **[trimRight](#trimRight)** ([code](lib/string.js#L657) | [
|
|
335
|
+
* **[trimLeft](#trimLeft)** ([code](lib/string.js#L639) | [tests](test/string.js#L436))
|
|
336
|
+
* **[trimRight](#trimRight)** ([code](lib/string.js#L657) | [tests](test/string.js#L441))
|
|
347
337
|
* **[truncate](#truncate)** ([code](lib/string.js#L680) | [tests](test/string.js#L338))
|
|
348
|
-
* **[truncateWords](#truncateWords)** ([code](lib/string.js#L712) | [
|
|
349
|
-
* **[upcase](#upcase)** ([code](lib/string.js#L742) | [
|
|
338
|
+
* **[truncateWords](#truncateWords)** ([code](lib/string.js#L712) | [tests](test/string.js#L447)))
|
|
339
|
+
* **[upcase](#upcase)** ([code](lib/string.js#L742) | [tests](test/string.js#458))
|
|
350
340
|
* **[uppercase](#uppercase)** ([code](lib/string.js#L763) | [tests](test/string.js#L362))
|
|
351
341
|
|
|
352
342
|
### [url helpers](#url)
|
|
@@ -354,14 +344,14 @@ Visit the: [code](lib/string.js) | [unit tests](test/string.js) | [issues](https
|
|
|
354
344
|
Visit the: [code](lib/url.js) | [unit tests](test/url.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+url+helpers))
|
|
355
345
|
|
|
356
346
|
* **[encodeURI](#encodeURI)** ([code](lib/url.js#L19) | [tests](test/url.js#L31))
|
|
357
|
-
* **[escape](#escape)** ([code](lib/url.js#L34) | [
|
|
347
|
+
* **[escape](#escape)** ([code](lib/url.js#L34) | [tests](test/url.js#L81))
|
|
358
348
|
* **[decodeURI](#decodeURI)** ([code](lib/url.js#L48) | [tests](test/url.js#L38))
|
|
359
|
-
* **[url_encode](#url_encode)** ([code](lib/url.js#L59) | [
|
|
360
|
-
* **[url_decode](#url_decode)** ([code](lib/url.js#L68) | [
|
|
349
|
+
* **[url_encode](#url_encode)** ([code](lib/url.js#L59) | [tests](test/url.js#L89))
|
|
350
|
+
* **[url_decode](#url_decode)** ([code](lib/url.js#L68) | [tests](test/url.js#L93))
|
|
361
351
|
* **[urlResolve](#urlResolve)** ([code](lib/url.js#L82) | [tests](test/url.js#L11))
|
|
362
352
|
* **[urlParse](#urlParse)** ([code](lib/url.js#L94) | [tests](test/url.js#L45))
|
|
363
353
|
* **[stripQuerystring](#stripQuerystring)** ([code](lib/url.js#L106) | [tests](test/url.js#L24))
|
|
364
|
-
* **[stripProtocol](#stripProtocol)** ([code](lib/url.js#L126) | [
|
|
354
|
+
* **[stripProtocol](#stripProtocol)** ([code](lib/url.js#L126) | [tests](test/url.js#L53))
|
|
365
355
|
|
|
366
356
|
***
|
|
367
357
|
|
package/index.d.ts
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
1
|
// index.d.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { Handlebars } from 'handlebars';
|
|
5
|
-
|
|
6
|
-
// Assuming helpers.js exports a function. Adjust as needed.
|
|
7
|
-
interface HelpersFunction {
|
|
8
|
-
(config: { handlebars: typeof Handlebars }): void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Since you're exporting the handlebars instance itself:
|
|
12
|
-
declare const handlebars: typeof Handlebars;
|
|
13
|
-
|
|
14
|
-
export = handlebars;
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import * as Handlebars from 'handlebars';
|
|
3
|
+
export = Handlebars;
|
package/lib/math.js
CHANGED
package/lib/path.js
CHANGED
|
@@ -5,6 +5,15 @@ var path = require('path');
|
|
|
5
5
|
var utils = require('./utils');
|
|
6
6
|
var helpers = module.exports;
|
|
7
7
|
|
|
8
|
+
utils.expectedType = (variableName, expectedType, variableValue) => {
|
|
9
|
+
const actualType = Object.prototype.toString.call(variableValue).slice(8, -1).toLowerCase();
|
|
10
|
+
|
|
11
|
+
if (actualType !== expectedType) {
|
|
12
|
+
throw new TypeError(`Expected ${variableName} to be of type ${expectedType}, but got ${actualType}`);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
|
|
8
17
|
/**
|
|
9
18
|
* Get the directory path segment from the given `filepath`.
|
|
10
19
|
*
|
package/lib/regex.js
CHANGED
|
@@ -43,7 +43,7 @@ helpers.test = function(str, regex) {
|
|
|
43
43
|
if (!util.isString(str)) {
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
46
|
-
if (
|
|
46
|
+
if (utils.typeOf(regex) !== 'regexp') {
|
|
47
47
|
throw new TypeError('expected a regular expression');
|
|
48
48
|
}
|
|
49
49
|
return regex.test(str);
|
package/lib/string.js
CHANGED
|
@@ -460,7 +460,7 @@ helpers.replace = function(str, a, b) {
|
|
|
460
460
|
* Replace the first occurrence of substring `a` with substring `b`.
|
|
461
461
|
*
|
|
462
462
|
* ```handlebars
|
|
463
|
-
* {{
|
|
463
|
+
* {{replaceFirst "a b a b a b" "a" "z"}}
|
|
464
464
|
* <!-- results in: 'z b a b a b' -->
|
|
465
465
|
* ```
|
|
466
466
|
* @param {String} `str`
|
|
@@ -695,9 +695,9 @@ helpers.truncate = function(str, limit, suffix) {
|
|
|
695
695
|
*
|
|
696
696
|
* ```handlebars
|
|
697
697
|
* truncateWords("foo bar baz", 1);
|
|
698
|
-
* <!-- results in: 'foo
|
|
698
|
+
* <!-- results in: 'foo...' -->
|
|
699
699
|
* truncateWords("foo bar baz", 2);
|
|
700
|
-
* <!-- results in: 'foo bar
|
|
700
|
+
* <!-- results in: 'foo bar...' -->
|
|
701
701
|
* truncateWords("foo bar baz", 3);
|
|
702
702
|
* <!-- results in: 'foo bar baz' -->
|
|
703
703
|
* ```
|
|
@@ -712,12 +712,12 @@ helpers.truncate = function(str, limit, suffix) {
|
|
|
712
712
|
helpers.truncateWords = function(str, count, suffix) {
|
|
713
713
|
if (util.isString(str) && isNumber(count)) {
|
|
714
714
|
if (typeof suffix !== 'string') {
|
|
715
|
-
suffix = '
|
|
715
|
+
suffix = '...';
|
|
716
716
|
}
|
|
717
717
|
|
|
718
718
|
var num = Number(count);
|
|
719
|
-
var arr = str.split(
|
|
720
|
-
if (num
|
|
719
|
+
var arr = str.split(' ');
|
|
720
|
+
if (num < arr.length) {
|
|
721
721
|
arr = arr.slice(0, num);
|
|
722
722
|
}
|
|
723
723
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jaredwray/fumanchu",
|
|
3
3
|
"description": "Handlebars + Helpers = Fumanchu",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"homepage": "https://github.com/jaredwray/fumanchu",
|
|
6
6
|
"author": "Jared Wray (me@jaredwray.com)",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"array",
|
|
9
|
+
"assemble",
|
|
10
|
+
"collection",
|
|
11
|
+
"comparison",
|
|
12
|
+
"date",
|
|
13
|
+
"handlebars",
|
|
14
|
+
"helper",
|
|
15
|
+
"helpers",
|
|
16
|
+
"html",
|
|
17
|
+
"i18n",
|
|
18
|
+
"inflection",
|
|
19
|
+
"log",
|
|
20
|
+
"logging",
|
|
21
|
+
"markdown",
|
|
22
|
+
"math",
|
|
23
|
+
"number",
|
|
24
|
+
"object",
|
|
25
|
+
"path",
|
|
26
|
+
"repeat",
|
|
27
|
+
"string",
|
|
28
|
+
"template",
|
|
29
|
+
"time",
|
|
30
|
+
"url",
|
|
31
|
+
"util",
|
|
32
|
+
"utility"
|
|
33
|
+
],
|
|
7
34
|
"contributors": [
|
|
8
35
|
"Adrián Mugnolo (https://github.com/xymbol)",
|
|
9
36
|
"Aleš Kotnik (www.draagle.com)",
|
|
@@ -70,15 +97,13 @@
|
|
|
70
97
|
"source": "index.js",
|
|
71
98
|
"main": "index.js",
|
|
72
99
|
"types": "index.d.ts",
|
|
73
|
-
"browser": "dist/fumanchu.min.js",
|
|
74
100
|
"engines": {
|
|
75
101
|
"node": ">=14"
|
|
76
102
|
},
|
|
77
103
|
"scripts": {
|
|
78
104
|
"test": "c8 mocha --reporter list",
|
|
79
105
|
"test:ci": "c8 --reporter=lcov mocha --reporter list",
|
|
80
|
-
"
|
|
81
|
-
"clean": "rm -rf node_modules && rm -rf dist && rm -rf .parcel-cache"
|
|
106
|
+
"clean": "rm -rf node_modules && rm -rf coverage"
|
|
82
107
|
},
|
|
83
108
|
"dependencies": {
|
|
84
109
|
"arr-flatten": "^1.1.0",
|
|
@@ -111,49 +136,10 @@
|
|
|
111
136
|
"year": "^0.2.1"
|
|
112
137
|
},
|
|
113
138
|
"devDependencies": {
|
|
114
|
-
"@parcel/watcher": "^2.3.0",
|
|
115
139
|
"c8": "^8.0.1",
|
|
116
140
|
"chai": "^4.3.8",
|
|
117
|
-
"global-modules": "^2.0.0",
|
|
118
141
|
"mocha": "^10.2.0",
|
|
119
|
-
"parcel": "^2.9.3",
|
|
120
142
|
"template-helpers": "^1.0.1",
|
|
121
143
|
"templates": "^1.2.9"
|
|
122
|
-
},
|
|
123
|
-
"keywords": [
|
|
124
|
-
"array",
|
|
125
|
-
"assemble",
|
|
126
|
-
"collection",
|
|
127
|
-
"comparison",
|
|
128
|
-
"date",
|
|
129
|
-
"handlebars",
|
|
130
|
-
"helper",
|
|
131
|
-
"helpers",
|
|
132
|
-
"html",
|
|
133
|
-
"i18n",
|
|
134
|
-
"inflection",
|
|
135
|
-
"log",
|
|
136
|
-
"logging",
|
|
137
|
-
"markdown",
|
|
138
|
-
"math",
|
|
139
|
-
"number",
|
|
140
|
-
"object",
|
|
141
|
-
"path",
|
|
142
|
-
"repeat",
|
|
143
|
-
"string",
|
|
144
|
-
"template",
|
|
145
|
-
"time",
|
|
146
|
-
"url",
|
|
147
|
-
"util",
|
|
148
|
-
"utility"
|
|
149
|
-
],
|
|
150
|
-
"browserslist": [
|
|
151
|
-
"last 1 version",
|
|
152
|
-
"> 1%",
|
|
153
|
-
"not dead"
|
|
154
|
-
],
|
|
155
|
-
"targets": {
|
|
156
|
-
"main": false,
|
|
157
|
-
"types": false
|
|
158
144
|
}
|
|
159
145
|
}
|