Merge 2dce597303
into e8ba7ece29
commit
1237f9ead6
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,7 +1,20 @@
|
||||
export default function excerptContent(content, words = 10) {
|
||||
export function excerptContent(content, words = 10) {
|
||||
return content
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.slice(0, words)
|
||||
.join(' ');
|
||||
}
|
||||
|
||||
export function excerptContentRange(content, start, end) {
|
||||
return content
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.slice(start, end)
|
||||
.join(' ');
|
||||
}
|
||||
|
||||
export default {
|
||||
excerptContent,
|
||||
excerptContentRange,
|
||||
};
|
||||
|
Loading…
Reference in New Issue