Skip to content

Commit

Permalink
v0.0.10, defensive checks
Browse files Browse the repository at this point in the history
  • Loading branch information
crosshj committed Aug 25, 2022
1 parent fc95074 commit eba6837
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fiug/layout",
"version": "0.0.9",
"version": "0.0.10",
"description": "page layout for browser applications",
"main": "dist/layout.js",
"exports": {
Expand Down
5 changes: 3 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const randomId = (prefix="_") =>
prefix + Math.random().toString(16).replace('0.','');


export function UrlParams(url){
export function UrlParams(url=""){
const paramsString = url.includes('?')
? url.split('?').pop()
: "";
Expand All @@ -34,9 +34,10 @@ export function addParams(url, toAdd){
return url.split("?").shift() + "?" + newParams.toString();
}

export const getFilename = (target) => {
export const getFilename = (target="") => {
const params = UrlParams(target);
const path = params.get('file');
if(!path) return "";
const filename = path.split("/").pop();
return filename;
};
Expand Down

0 comments on commit eba6837

Please sign in to comment.