MCPcopy
hub / github.com/lowlighter/metrics / parse

Function parse

source/plugins/community/splatoon/s3si/index.ts:736–981  ·  view source on GitHub ↗
(args, { "--": doubleDash = false , alias ={} , boolean: __boolean = false , default: defaults = {} , stopEarly =false , string =[] , collect =[] , negatable =[] , unknown =(i)=>i  } = {})

Source from the content-addressed store, hash-verified

734 return hasOwn(o, key);
735}
736function parse(args, { "--": doubleDash = false , alias ={} , boolean: __boolean = false , default: defaults = {} , stopEarly =false , string =[] , collect =[] , negatable =[] , unknown =(i)=>i } = {}) {
737 const flags = {
738 bools: {},
739 strings: {},
740 unknownFn: unknown,
741 allBools: false,
742 collect: {},
743 negatable: {}
744 };
745 if (__boolean !== undefined) {
746 if (typeof __boolean === "boolean") {
747 flags.allBools = !!__boolean;
748 } else {
749 const booleanArgs = typeof __boolean === "string" ? [
750 __boolean
751 ] : __boolean;
752 for (const key of booleanArgs.filter(Boolean)){
753 flags.bools[key] = true;
754 }
755 }
756 }
757 const aliases = {};
758 if (alias !== undefined) {
759 for(const key in alias){
760 const val = getForce(alias, key);
761 if (typeof val === "string") {
762 aliases[key] = [
763 val
764 ];
765 } else {
766 aliases[key] = val;
767 }
768 for (const alias of getForce(aliases, key)){
769 aliases[alias] = [
770 key
771 ].concat(aliases[key].filter((y)=>alias !== y));
772 }
773 }
774 }
775 if (string !== undefined) {
776 const stringArgs = typeof string === "string" ? [
777 string
778 ] : string;
779 for (const key of stringArgs.filter(Boolean)){
780 flags.strings[key] = true;
781 const alias = get(aliases, key);
782 if (alias) {
783 for (const al of alias){
784 flags.strings[al] = true;
785 }
786 }
787 }
788 }
789 if (collect !== undefined) {
790 const collectArgs = typeof collect === "string" ? [
791 collect
792 ] : collect;
793 for (const key of collectArgs.filter(Boolean)){

Callers

nothing calls this directly

Calls 11

getForceFunction · 0.85
assertFunction · 0.85
setArgFunction · 0.85
aliasIsBooleanFunction · 0.85
isNumberFunction · 0.85
hasKeyFunction · 0.85
setKeyFunction · 0.85
filterMethod · 0.80
concatMethod · 0.80
sliceMethod · 0.80
getFunction · 0.70

Tested by

no test coverage detected