path-string-prepend
Advanced tools
@@ -0,1 +1,6 @@ | ||
| export interface PrependResult { | ||
| added: string[]; | ||
| removed: string[]; | ||
| path: string; | ||
| } | ||
| export interface PrependOptions { | ||
@@ -6,6 +11,3 @@ delimiter?: string; | ||
| } | ||
| export default function prepend(pathString: string, prependPath: string, options?: PrependOptions): string | { | ||
| added: any[]; | ||
| removed: any[]; | ||
| path: string; | ||
| }; | ||
| export default function prepend(pathString: string, prependPath: string, options?: PrependOptions): PrependResult; | ||
| export default function prepend(pathString: string, prependPath: string, options?: PrependOptions): string; |
@@ -0,1 +1,6 @@ | ||
| export interface PrependResult { | ||
| added: string[]; | ||
| removed: string[]; | ||
| path: string; | ||
| } | ||
| export interface PrependOptions { | ||
@@ -6,6 +11,3 @@ delimiter?: string; | ||
| } | ||
| export default function prepend(pathString: string, prependPath: string, options?: PrependOptions): string | { | ||
| added: any[]; | ||
| removed: any[]; | ||
| path: string; | ||
| }; | ||
| export default function prepend(pathString: string, prependPath: string, options?: PrependOptions): PrependResult; | ||
| export default function prepend(pathString: string, prependPath: string, options?: PrependOptions): string; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/path-string-prepend/src/index.ts"],"sourcesContent":["import path from 'path';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nconst pathDelimiter = path.delimiter ? path.delimiter : isWindows ? ';' : ':';\n\nconst filterNone = (_path?: string) => true;\n\nexport interface PrependOptions {\n delimiter?: string;\n filter?: (_path?: string) => boolean;\n changes?: boolean;\n}\n\nexport default function prepend(pathString: string, prependPath: string, options: PrependOptions = {}) {\n const delimiter = options.delimiter || pathDelimiter;\n\n const changes = { added: [], removed: [], path: '' };\n const parts = pathString.split(delimiter);\n const filter = options.filter || filterNone;\n\n // add to start\n if (!parts.length || parts[0] !== prependPath) {\n changes.added.push(prependPath);\n parts.unshift(prependPath);\n }\n\n // remove duplicates\n for (let index = 1; index < parts.length; index++) {\n const prependPathPart = parts[index];\n\n // remove\n if (prependPathPart.indexOf(prependPath) >= 0 || !filter(prependPathPart)) {\n changes.removed.push(prependPathPart);\n parts.splice(index, 1);\n index--;\n }\n }\n\n changes.path = parts.join(delimiter);\n return options.changes ? changes : changes.path;\n}\n"],"names":["prepend","isWindows","process","platform","test","env","OSTYPE","pathDelimiter","path","delimiter","filterNone","_path","pathString","prependPath","options","changes","added","removed","parts","split","filter","length","push","unshift","index","prependPathPart","indexOf","splice","join"],"mappings":";;;;+BAaA;;;eAAwBA;;;2DAbP;;;;;;AAEjB,IAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,IAAMC,gBAAgBC,aAAI,CAACC,SAAS,GAAGD,aAAI,CAACC,SAAS,GAAGR,YAAY,MAAM;AAE1E,IAAMS,aAAa,SAACC;WAAmB;;AAQxB,SAASX,QAAQY,UAAkB,EAAEC,WAAmB;QAAEC,UAAAA,iEAA0B,CAAC;IAClG,IAAML,YAAYK,QAAQL,SAAS,IAAIF;IAEvC,IAAMQ,UAAU;QAAEC,OAAO,EAAE;QAAEC,SAAS,EAAE;QAAET,MAAM;IAAG;IACnD,IAAMU,QAAQN,WAAWO,KAAK,CAACV;IAC/B,IAAMW,SAASN,QAAQM,MAAM,IAAIV;IAEjC,eAAe;IACf,IAAI,CAACQ,MAAMG,MAAM,IAAIH,KAAK,CAAC,EAAE,KAAKL,aAAa;QAC7CE,QAAQC,KAAK,CAACM,IAAI,CAACT;QACnBK,MAAMK,OAAO,CAACV;IAChB;IAEA,oBAAoB;IACpB,IAAK,IAAIW,QAAQ,GAAGA,QAAQN,MAAMG,MAAM,EAAEG,QAAS;QACjD,IAAMC,kBAAkBP,KAAK,CAACM,MAAM;QAEpC,SAAS;QACT,IAAIC,gBAAgBC,OAAO,CAACb,gBAAgB,KAAK,CAACO,OAAOK,kBAAkB;YACzEV,QAAQE,OAAO,CAACK,IAAI,CAACG;YACrBP,MAAMS,MAAM,CAACH,OAAO;YACpBA;QACF;IACF;IAEAT,QAAQP,IAAI,GAAGU,MAAMU,IAAI,CAACnB;IAC1B,OAAOK,QAAQC,OAAO,GAAGA,UAAUA,QAAQP,IAAI;AACjD"} | ||
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/path-string-prepend/src/index.ts"],"sourcesContent":["import path from 'path';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nconst pathDelimiter = path.delimiter ? path.delimiter : isWindows ? ';' : ':';\n\nconst filterNone = (_path?: string) => true;\n\nexport interface PrependResult {\n added: string[];\n removed: string[];\n path: string;\n}\n\nexport interface PrependOptions {\n delimiter?: string;\n filter?: (_path?: string) => boolean;\n changes?: boolean;\n}\n\nexport default function prepend(pathString: string, prependPath: string, options?: PrependOptions): PrependResult;\nexport default function prepend(pathString: string, prependPath: string, options?: PrependOptions): string;\nexport default function prepend(pathString: string, prependPath: string, options: PrependOptions = {}): PrependResult | string {\n const delimiter = options.delimiter || pathDelimiter;\n const changes = { added: [], removed: [], path: '' };\n const parts = pathString.split(delimiter);\n const filter = options.filter || filterNone;\n\n // add to start\n if (!parts.length || parts[0] !== prependPath) {\n changes.added.push(prependPath);\n parts.unshift(prependPath);\n }\n\n // remove duplicates\n for (let index = 1; index < parts.length; index++) {\n const prependPathPart = parts[index];\n\n // remove\n if (prependPathPart.indexOf(prependPath) >= 0 || !filter(prependPathPart)) {\n changes.removed.push(prependPathPart);\n parts.splice(index, 1);\n index--;\n }\n }\n\n changes.path = parts.join(delimiter);\n return options.changes ? changes : changes.path;\n}\n"],"names":["prepend","isWindows","process","platform","test","env","OSTYPE","pathDelimiter","path","delimiter","filterNone","_path","pathString","prependPath","options","changes","added","removed","parts","split","filter","length","push","unshift","index","prependPathPart","indexOf","splice","join"],"mappings":";;;;+BAqBA;;;eAAwBA;;;2DArBP;;;;;;AAEjB,IAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,IAAMC,gBAAgBC,aAAI,CAACC,SAAS,GAAGD,aAAI,CAACC,SAAS,GAAGR,YAAY,MAAM;AAE1E,IAAMS,aAAa,SAACC;WAAmB;;AAgBxB,SAASX,QAAQY,UAAkB,EAAEC,WAAmB;QAAEC,UAAAA,iEAA0B,CAAC;IAClG,IAAML,YAAYK,QAAQL,SAAS,IAAIF;IACvC,IAAMQ,UAAU;QAAEC,OAAO,EAAE;QAAEC,SAAS,EAAE;QAAET,MAAM;IAAG;IACnD,IAAMU,QAAQN,WAAWO,KAAK,CAACV;IAC/B,IAAMW,SAASN,QAAQM,MAAM,IAAIV;IAEjC,eAAe;IACf,IAAI,CAACQ,MAAMG,MAAM,IAAIH,KAAK,CAAC,EAAE,KAAKL,aAAa;QAC7CE,QAAQC,KAAK,CAACM,IAAI,CAACT;QACnBK,MAAMK,OAAO,CAACV;IAChB;IAEA,oBAAoB;IACpB,IAAK,IAAIW,QAAQ,GAAGA,QAAQN,MAAMG,MAAM,EAAEG,QAAS;QACjD,IAAMC,kBAAkBP,KAAK,CAACM,MAAM;QAEpC,SAAS;QACT,IAAIC,gBAAgBC,OAAO,CAACb,gBAAgB,KAAK,CAACO,OAAOK,kBAAkB;YACzEV,QAAQE,OAAO,CAACK,IAAI,CAACG;YACrBP,MAAMS,MAAM,CAACH,OAAO;YACpBA;QACF;IACF;IAEAT,QAAQP,IAAI,GAAGU,MAAMU,IAAI,CAACnB;IAC1B,OAAOK,QAAQC,OAAO,GAAGA,UAAUA,QAAQP,IAAI;AACjD"} |
@@ -0,1 +1,6 @@ | ||
| export interface PrependResult { | ||
| added: string[]; | ||
| removed: string[]; | ||
| path: string; | ||
| } | ||
| export interface PrependOptions { | ||
@@ -6,6 +11,3 @@ delimiter?: string; | ||
| } | ||
| export default function prepend(pathString: string, prependPath: string, options?: PrependOptions): string | { | ||
| added: any[]; | ||
| removed: any[]; | ||
| path: string; | ||
| }; | ||
| export default function prepend(pathString: string, prependPath: string, options?: PrependOptions): PrependResult; | ||
| export default function prepend(pathString: string, prependPath: string, options?: PrependOptions): string; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/path-string-prepend/src/index.ts"],"sourcesContent":["import path from 'path';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nconst pathDelimiter = path.delimiter ? path.delimiter : isWindows ? ';' : ':';\n\nconst filterNone = (_path?: string) => true;\n\nexport interface PrependOptions {\n delimiter?: string;\n filter?: (_path?: string) => boolean;\n changes?: boolean;\n}\n\nexport default function prepend(pathString: string, prependPath: string, options: PrependOptions = {}) {\n const delimiter = options.delimiter || pathDelimiter;\n\n const changes = { added: [], removed: [], path: '' };\n const parts = pathString.split(delimiter);\n const filter = options.filter || filterNone;\n\n // add to start\n if (!parts.length || parts[0] !== prependPath) {\n changes.added.push(prependPath);\n parts.unshift(prependPath);\n }\n\n // remove duplicates\n for (let index = 1; index < parts.length; index++) {\n const prependPathPart = parts[index];\n\n // remove\n if (prependPathPart.indexOf(prependPath) >= 0 || !filter(prependPathPart)) {\n changes.removed.push(prependPathPart);\n parts.splice(index, 1);\n index--;\n }\n }\n\n changes.path = parts.join(delimiter);\n return options.changes ? changes : changes.path;\n}\n"],"names":["path","isWindows","process","platform","test","env","OSTYPE","pathDelimiter","delimiter","filterNone","_path","prepend","pathString","prependPath","options","changes","added","removed","parts","split","filter","length","push","unshift","index","prependPathPart","indexOf","splice","join"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AAExB,MAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,MAAMC,gBAAgBP,KAAKQ,SAAS,GAAGR,KAAKQ,SAAS,GAAGP,YAAY,MAAM;AAE1E,MAAMQ,aAAa,CAACC,QAAmB;AAQvC,eAAe,SAASC,QAAQC,UAAkB,EAAEC,WAAmB,EAAEC,UAA0B,CAAC,CAAC;IACnG,MAAMN,YAAYM,QAAQN,SAAS,IAAID;IAEvC,MAAMQ,UAAU;QAAEC,OAAO,EAAE;QAAEC,SAAS,EAAE;QAAEjB,MAAM;IAAG;IACnD,MAAMkB,QAAQN,WAAWO,KAAK,CAACX;IAC/B,MAAMY,SAASN,QAAQM,MAAM,IAAIX;IAEjC,eAAe;IACf,IAAI,CAACS,MAAMG,MAAM,IAAIH,KAAK,CAAC,EAAE,KAAKL,aAAa;QAC7CE,QAAQC,KAAK,CAACM,IAAI,CAACT;QACnBK,MAAMK,OAAO,CAACV;IAChB;IAEA,oBAAoB;IACpB,IAAK,IAAIW,QAAQ,GAAGA,QAAQN,MAAMG,MAAM,EAAEG,QAAS;QACjD,MAAMC,kBAAkBP,KAAK,CAACM,MAAM;QAEpC,SAAS;QACT,IAAIC,gBAAgBC,OAAO,CAACb,gBAAgB,KAAK,CAACO,OAAOK,kBAAkB;YACzEV,QAAQE,OAAO,CAACK,IAAI,CAACG;YACrBP,MAAMS,MAAM,CAACH,OAAO;YACpBA;QACF;IACF;IAEAT,QAAQf,IAAI,GAAGkB,MAAMU,IAAI,CAACpB;IAC1B,OAAOM,QAAQC,OAAO,GAAGA,UAAUA,QAAQf,IAAI;AACjD"} | ||
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/path-string-prepend/src/index.ts"],"sourcesContent":["import path from 'path';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nconst pathDelimiter = path.delimiter ? path.delimiter : isWindows ? ';' : ':';\n\nconst filterNone = (_path?: string) => true;\n\nexport interface PrependResult {\n added: string[];\n removed: string[];\n path: string;\n}\n\nexport interface PrependOptions {\n delimiter?: string;\n filter?: (_path?: string) => boolean;\n changes?: boolean;\n}\n\nexport default function prepend(pathString: string, prependPath: string, options?: PrependOptions): PrependResult;\nexport default function prepend(pathString: string, prependPath: string, options?: PrependOptions): string;\nexport default function prepend(pathString: string, prependPath: string, options: PrependOptions = {}): PrependResult | string {\n const delimiter = options.delimiter || pathDelimiter;\n const changes = { added: [], removed: [], path: '' };\n const parts = pathString.split(delimiter);\n const filter = options.filter || filterNone;\n\n // add to start\n if (!parts.length || parts[0] !== prependPath) {\n changes.added.push(prependPath);\n parts.unshift(prependPath);\n }\n\n // remove duplicates\n for (let index = 1; index < parts.length; index++) {\n const prependPathPart = parts[index];\n\n // remove\n if (prependPathPart.indexOf(prependPath) >= 0 || !filter(prependPathPart)) {\n changes.removed.push(prependPathPart);\n parts.splice(index, 1);\n index--;\n }\n }\n\n changes.path = parts.join(delimiter);\n return options.changes ? changes : changes.path;\n}\n"],"names":["path","isWindows","process","platform","test","env","OSTYPE","pathDelimiter","delimiter","filterNone","_path","prepend","pathString","prependPath","options","changes","added","removed","parts","split","filter","length","push","unshift","index","prependPathPart","indexOf","splice","join"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AAExB,MAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,MAAMC,gBAAgBP,KAAKQ,SAAS,GAAGR,KAAKQ,SAAS,GAAGP,YAAY,MAAM;AAE1E,MAAMQ,aAAa,CAACC,QAAmB;AAgBvC,eAAe,SAASC,QAAQC,UAAkB,EAAEC,WAAmB,EAAEC,UAA0B,CAAC,CAAC;IACnG,MAAMN,YAAYM,QAAQN,SAAS,IAAID;IACvC,MAAMQ,UAAU;QAAEC,OAAO,EAAE;QAAEC,SAAS,EAAE;QAAEjB,MAAM;IAAG;IACnD,MAAMkB,QAAQN,WAAWO,KAAK,CAACX;IAC/B,MAAMY,SAASN,QAAQM,MAAM,IAAIX;IAEjC,eAAe;IACf,IAAI,CAACS,MAAMG,MAAM,IAAIH,KAAK,CAAC,EAAE,KAAKL,aAAa;QAC7CE,QAAQC,KAAK,CAACM,IAAI,CAACT;QACnBK,MAAMK,OAAO,CAACV;IAChB;IAEA,oBAAoB;IACpB,IAAK,IAAIW,QAAQ,GAAGA,QAAQN,MAAMG,MAAM,EAAEG,QAAS;QACjD,MAAMC,kBAAkBP,KAAK,CAACM,MAAM;QAEpC,SAAS;QACT,IAAIC,gBAAgBC,OAAO,CAACb,gBAAgB,KAAK,CAACO,OAAOK,kBAAkB;YACzEV,QAAQE,OAAO,CAACK,IAAI,CAACG;YACrBP,MAAMS,MAAM,CAACH,OAAO;YACpBA;QACF;IACF;IAEAT,QAAQf,IAAI,GAAGkB,MAAMU,IAAI,CAACpB;IAC1B,OAAOM,QAAQC,OAAO,GAAGA,UAAUA,QAAQf,IAAI;AACjD"} |
+1
-1
| { | ||
| "name": "path-string-prepend", | ||
| "version": "1.0.20", | ||
| "version": "1.0.21", | ||
| "description": "Prepends a path to a platform-specfic delimited path string and removes duplicate paths", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
13173
9.51%104
4%