File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 22 "author" : " Transcend Inc." ,
33 "name" : " @transcend-io/handlebars-utils" ,
44 "description" : " Utility functions for handlebars templating with Transcend - available in node and client side." ,
5- "version" : " 1.0.1 " ,
5+ "version" : " 1.1.0 " ,
66 "homepage" : " https://github.com/transcend-io/handlebars-utils" ,
77 "repository" : {
88 "type" : " git" ,
Original file line number Diff line number Diff line change @@ -7,6 +7,27 @@ import { cases } from './change-case';
77// TODO: https://transcend.height.app/T-30349 - de-duplicate this with cli and node-util
88export { Handlebars } ;
99
10+ /**
11+ * Given a file name, return the desirable name for a handlebars extension
12+ * The extension is in camel case without the file suffix, and all slashes
13+ * and spaces get removed
14+ *
15+ * @param fileName - Filename
16+ * @param extension - File extension
17+ * @returns Partial name
18+ */
19+ export function getPartialNameFromFileName (
20+ fileName : string ,
21+ extension = 'hbs' ,
22+ ) : string {
23+ return cases . camelCase (
24+ fileName
25+ . slice ( 0 , fileName . length - `.${ extension } ` . length )
26+ . split ( '/' )
27+ . pop ( ) ,
28+ ) ;
29+ }
30+
1031/**
1132 * Input for creating a handlebars instance
1233 */
You can’t perform that action at this time.
0 commit comments