@tryghost/helpers 1.1.94 → 1.1.95
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/es/helpers.js +6 -9
- package/es/helpers.js.map +1 -1
- package/package.json +3 -3
- package/umd/helpers.min.js +1 -1
- package/umd/helpers.min.js.map +1 -1
package/es/helpers.js
CHANGED
|
@@ -3580,11 +3580,10 @@ function countImages(html) {
|
|
|
3580
3580
|
return (html.match(/<img("[^"]*"|'[^']*'|[^'">])+\/?>/g) || []).length;
|
|
3581
3581
|
}
|
|
3582
3582
|
|
|
3583
|
-
function estimatedReadingTimeInMinutes(
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
} = _ref;
|
|
3583
|
+
function estimatedReadingTimeInMinutes({
|
|
3584
|
+
wordCount,
|
|
3585
|
+
imageCount
|
|
3586
|
+
}) {
|
|
3588
3587
|
const wordsPerMinute = 275;
|
|
3589
3588
|
const wordsPerSecond = wordsPerMinute / 60;
|
|
3590
3589
|
let readingTimeSeconds = wordCount / wordsPerSecond;
|
|
@@ -3629,8 +3628,7 @@ function readingMinutes(html, additionalImages) {
|
|
|
3629
3628
|
* @returns {string} estimated reading in minutes
|
|
3630
3629
|
*/
|
|
3631
3630
|
|
|
3632
|
-
function readingTime (post) {
|
|
3633
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3631
|
+
function readingTime (post, options = {}) {
|
|
3634
3632
|
const minuteStr = typeof options.minute === 'string' ? options.minute : '1 min read';
|
|
3635
3633
|
const minutesStr = typeof options.minutes === 'string' ? options.minutes : '% min read';
|
|
3636
3634
|
if (!post.html && !post.reading_time) {
|
|
@@ -4328,8 +4326,7 @@ var zip$1 = zip;
|
|
|
4328
4326
|
* @param {function} [options.fn] - function to call on each tag, default returns tag.name
|
|
4329
4327
|
* @returns {String|*} processed tags, comma separated names by default
|
|
4330
4328
|
*/
|
|
4331
|
-
function tags (data) {
|
|
4332
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4329
|
+
function tags (data, options = {}) {
|
|
4333
4330
|
let output = '';
|
|
4334
4331
|
let separator = options.separator ? options.separator : '';
|
|
4335
4332
|
let prefix = options.prefix ? options.prefix : '';
|