astro-accelerator-utils 0.3.1 → 0.3.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/lib/postOrdering.d.mts +7 -0
- package/lib/postOrdering.mjs +12 -0
- package/lib/v1/markdown.mjs +1 -2
- package/package.json +1 -1
package/lib/postOrdering.d.mts
CHANGED
|
@@ -22,4 +22,11 @@ export function sortByPubDateDesc(a: MarkdownInstance, b: MarkdownInstance): any
|
|
|
22
22
|
* @returns {any}
|
|
23
23
|
*/
|
|
24
24
|
export function sortByModDate(a: MarkdownInstance, b: MarkdownInstance): any;
|
|
25
|
+
/**
|
|
26
|
+
* Sorts by the modDate field
|
|
27
|
+
* @param {MarkdownInstance} a
|
|
28
|
+
* @param {MarkdownInstance} b
|
|
29
|
+
* @returns {any}
|
|
30
|
+
*/
|
|
31
|
+
export function sortByModDateDesc(a: MarkdownInstance, b: MarkdownInstance): any;
|
|
25
32
|
export type MarkdownInstance = import("../types/Astro").MarkdownInstance;
|
package/lib/postOrdering.mjs
CHANGED
|
@@ -37,3 +37,15 @@ export function sortByModDate (a, b) {
|
|
|
37
37
|
const dateB = b.frontmatter.modDate || b.frontmatter.pubDate || '1970-01-01';
|
|
38
38
|
return dateA.localeCompare(dateB);
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Sorts by the modDate field
|
|
43
|
+
* @param {MarkdownInstance} a
|
|
44
|
+
* @param {MarkdownInstance} b
|
|
45
|
+
* @returns {any}
|
|
46
|
+
*/
|
|
47
|
+
export function sortByModDateDesc (a, b) {
|
|
48
|
+
const dateA = a.frontmatter.modDate || a.frontmatter.pubDate || '1970-01-01';
|
|
49
|
+
const dateB = b.frontmatter.modDate || b.frontmatter.pubDate || '1970-01-01';
|
|
50
|
+
return dateB.localeCompare(dateA);
|
|
51
|
+
}
|
package/lib/v1/markdown.mjs
CHANGED