{"_id":"typesafe-path","_rev":"3210352","name":"typesafe-path","description":"This library is aim to explicitly annotate path format of the code, and throwing error when passing incorrect format paths.","dist-tags":{"latest":"0.2.2"},"maintainers":[{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"}],"time":{"modified":"2024-02-18T06:01:44.000Z","created":"2022-10-01T05:20:10.643Z","0.2.2":"2022-10-11T18:53:23.179Z","0.2.1":"2022-10-04T11:42:37.877Z","0.2.0":"2022-10-01T07:13:26.171Z","0.1.0":"2022-10-01T05:20:10.643Z"},"users":{},"repository":{"type":"git","url":"git+https://github.com/johnsoncodehk/typesafe-path.git"},"versions":{"0.2.2":{"name":"typesafe-path","version":"0.2.2","main":"index.js","types":"index.d.ts","license":"MIT","repository":{"type":"git","url":"git+https://github.com/johnsoncodehk/typesafe-path.git"},"devDependencies":{"@types/node":"latest","typescript":"latest"},"gitHead":"154c70a728783a1ae9e3803355e4392ae983d97a","description":"This library is aim to explicitly annotate path format of the code, and throwing error when passing incorrect format paths.","bugs":{"url":"https://github.com/johnsoncodehk/typesafe-path/issues"},"homepage":"https://github.com/johnsoncodehk/typesafe-path#readme","_id":"typesafe-path@0.2.2","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"shasum":"91a436681b2f514badb114061b6a5e5c2b8943b1","size":2090,"noattachment":false,"key":"/typesafe-path/-/typesafe-path-0.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/typesafe-path/download/typesafe-path-0.2.2.tgz"},"_npmUser":{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"},"directories":{},"maintainers":[{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typesafe-path_0.2.2_1665514402939_0.9424467089701112"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-11T18:58:36.924Z","publish_time":1665514403179,"_cnpm_publish_time":1665514403179},"0.2.1":{"name":"typesafe-path","version":"0.2.1","main":"index.js","types":"index.d.ts","license":"MIT","repository":{"type":"git","url":"git+https://github.com/johnsoncodehk/typesafe-path.git"},"devDependencies":{"@types/node":"latest","typescript":"latest"},"gitHead":"ce29cc29a969b9fe3bf1ef642f0d09bea421a3a2","description":"This library is aim to explicitly annotate path format of the code, and throwing error when passing incorrect format paths.","bugs":{"url":"https://github.com/johnsoncodehk/typesafe-path/issues"},"homepage":"https://github.com/johnsoncodehk/typesafe-path#readme","_id":"typesafe-path@0.2.1","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"shasum":"2bd71374a943e2ae9b63833fc6c2974005bba912","size":2089,"noattachment":false,"key":"/typesafe-path/-/typesafe-path-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/typesafe-path/download/typesafe-path-0.2.1.tgz"},"_npmUser":{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"},"directories":{},"maintainers":[{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typesafe-path_0.2.1_1664883757715_0.32252982995394186"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-04T11:42:40.334Z","publish_time":1664883757877,"_cnpm_publish_time":1664883757877},"0.2.0":{"name":"typesafe-path","version":"0.2.0","main":"index.js","types":"index.d.ts","license":"MIT","repository":{"type":"git","url":"git+https://github.com/johnsoncodehk/typesafe-path.git"},"devDependencies":{"@types/node":"latest","typescript":"latest"},"gitHead":"da8dbe671bd3b7cd889ae2cd107d50be8b10cb99","description":"This library is aim to explicitly annotate path format of the code, and throwing error when passing incorrect format paths.","bugs":{"url":"https://github.com/johnsoncodehk/typesafe-path/issues"},"homepage":"https://github.com/johnsoncodehk/typesafe-path#readme","_id":"typesafe-path@0.2.0","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"shasum":"cdb6b2341fbbc3460fb6e281a39d5c403bcfccf4","size":2030,"noattachment":false,"key":"/typesafe-path/-/typesafe-path-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/typesafe-path/download/typesafe-path-0.2.0.tgz"},"_npmUser":{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"},"directories":{},"maintainers":[{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typesafe-path_0.2.0_1664608405973_0.8000813518951273"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-01T07:15:59.309Z","publish_time":1664608406171,"_cnpm_publish_time":1664608406171},"0.1.0":{"name":"typesafe-path","version":"0.1.0","main":"index.js","types":"index.d.ts","license":"MIT","repository":{"type":"git","url":"git+https://github.com/johnsoncodehk/typesafe-path.git"},"devDependencies":{"@types/node":"latest","typescript":"latest"},"description":"This library is aim to explicitly annotate path format of the code, and throwing error when passing incorrect format paths.","bugs":{"url":"https://github.com/johnsoncodehk/typesafe-path/issues"},"homepage":"https://github.com/johnsoncodehk/typesafe-path#readme","_id":"typesafe-path@0.1.0","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"shasum":"318287a54b5aaab4704d892c1bfe0ebdc70056f9","size":2027,"noattachment":false,"key":"/typesafe-path/-/typesafe-path-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/typesafe-path/download/typesafe-path-0.1.0.tgz"},"_npmUser":{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"},"directories":{},"maintainers":[{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typesafe-path_0.1.0_1664601610432_0.15172116417166914"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-01T05:20:18.365Z","publish_time":1664601610643,"_cnpm_publish_time":1664601610643}},"readme":"# TypeSafe Path\n\nThis library is aim to explicitly annotate path format of the code, and throwing error when passing incorrect format paths.\n\nThe advantage is that we can avoid using `upath` to convert all paths to unix path, and ensure current code logic always correctly know the path format that should be processed.\n\nPlease note that you should only use it in your modules that are coupled to the filesystem.\n\n## Usage\n\n```ts\nimport * as path from 'typesafe-path';\n\n/**\n * win32: __dirname is 'c:\\\\foo\\\\bar.js'\n * posix: __dirname is '/foo/bar.js'\n */\nconst osPath = __dirname as path.OsPath;\nconst win32Path = '..\\\\aaa\\\\bbb' as path.Win32Path;\n\n/**\n * win32: 'c:\\\\foo\\\\aaa\\\\bbb' <-- good result\n * posix: '/foo/bar.js/..\\\\aaa\\\\bbb' <-- bad result\n */\npath.resolve(osPath, win32Path);\n//                   ^ Argument of type 'Win32Path' is not assignable to parameter of type 'OsPath | PosixPath'.\n\n// Fixs\nconst posixPath = win32Path.replace(/\\\\/g, '/') as path.PosixPath;\npath.resolve(osPath, posixPath); // no type error\n```\n","_attachments":{},"homepage":"https://github.com/johnsoncodehk/typesafe-path#readme","bugs":{"url":"https://github.com/johnsoncodehk/typesafe-path/issues"},"license":"MIT"}