refac: SammoAPI Path 정의에 NumVar, StrVar 추가
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
export function APIPathGen(obj, callback, path) {
|
||||
return new Proxy(obj, {
|
||||
get(target, key) {
|
||||
if(typeof key === 'number'){
|
||||
key = key.toString();
|
||||
}
|
||||
else if(typeof key !== 'string'){
|
||||
throw `${key} is not string`;
|
||||
}
|
||||
let nextPath;
|
||||
if (path === undefined) {
|
||||
nextPath = [key];
|
||||
@@ -21,4 +27,8 @@ export function APIPathGen(obj, callback, path) {
|
||||
return APIPathGen(next, callback, nextPath);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function StrVar(){
|
||||
return (next)=>next;
|
||||
}
|
||||
Reference in New Issue
Block a user