-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generalize src/* IFC references to prepare for .obj support.
- Loading branch information
1 parent
719ed31
commit 5e39ab2
Showing
9 changed files
with
104 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
export const supportedTypes = ['ifc', 'obj'] | ||
|
||
|
||
/** | ||
* @param {string} ext | ||
* @return {boolean} Is supported | ||
*/ | ||
export function isExtensionSupported(ext) { | ||
return ext.match(/(?:ifc|obj)/i) | ||
} | ||
|
||
|
||
/** | ||
* @param {string} strWithSuffix | ||
* @return {boolean} Is supported | ||
*/ | ||
export function pathSuffixSupported(pathWithSuffix) { | ||
const lastDotNdx = pathWithSuffix.lastIndexOf('.') | ||
if (lastDotNdx === -1) { | ||
return false | ||
} | ||
return isExtensionSupported(pathWithSuffix.substring(lastDotNdx + 1)) | ||
} | ||
|
||
|
||
/** | ||
* @param {string} filepath | ||
* @return {Array.<string>} | ||
*/ | ||
export function splitAroundExtension(filepath) { | ||
const splitRegex = /\.(?:ifc|obj)/i | ||
const match = splitRegex.exec(filepath) | ||
if (!match) { | ||
throw new Error('Filepath must contain ".(ifc|obj)" (case-insensitive)') | ||
} | ||
const parts = filepath.split(splitRegex) | ||
return {parts, match} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters