{"_id":"@dhar/url-courte","_rev":"1-ade10835292c097777f34430ca26fc6a","name":"@dhar/url-courte","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"@dhar/url-courte","version":"1.0.0","description":"My own super simple algorithmically reversible, personal URL shortener.","main":"index.js","scripts":{"test":"node ./test/url-courte.test.js"},"keywords":["'URL","Shortener'","url","shortener"],"author":{"name":"Olivier Audard","email":"olivier@audard.net"},"directories":{"lib":"lib","test":"test"},"repository":{"type":"git","url":"git+https://github.com/dharFr/url-courte.git"},"license":"MIT","bugs":{"url":"https://github.com/dharFr/url-courte/issues"},"homepage":"https://github.com/dharFr/url-courte#readme","devDependencies":{"cli-color":"^2.0.3"},"gitHead":"c04683e8de006eae593c2c1df6012bbfbd5d2227","_id":"@dhar/url-courte@1.0.0","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-GducuADAhEzopGwSWhvpnmahBexgM6YfraFNCLpdd65e2uZOAb4QyK1s1QleiPy9F6tMPXJj3Hz6AqKKKJIYzQ==","shasum":"94b180e04674b4504fc13b8ec8625d0fafd5603b","tarball":"https://registry.npmjs.org/@dhar/url-courte/-/url-courte-1.0.0.tgz","fileCount":7,"unpackedSize":7145,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEYb+76VDPr+N0FA1IS9Xx1XInqKGHSTUY4PDjld3TeaAiBcPnWB2JtkzNeE6rQZiILTEhZYfO5EK4dv+q42CzYfkw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjyybLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo7SRAAj4z9xk/SHtlSW8Qqm+oeZi3Y1PhlXw9YnrEIrmVwnBFJviv3\r\nUsl688LQWUHtT5iAwBuAmORgM77ZQyZmE63nJiPJfprdNB7A0ZYo9XC+1DbH\r\nXqY8stRH6OHyIjC+GBKElM0SPR0VS8fLhVbu3CW3esKAPP8eiygNRYdop+an\r\npbj3pLgsm9FQgx13zcMuCFRK4VAItVUvPCMyGW4ST36hXmXfUQ1nqMbSw4o/\r\nNKVMwskEJNUBlIjgnm+blc9wLaMqfigM7nmX0h1ZMQX8vkZ/f7Z+UC0txOg0\r\nNGxYdjqIJSQIt3ZY8b9NfMw39/jUHguIHTSGngZC/TvNbeSCcCfbrwrVU6p3\r\noREGq67NBd/MRQ4np/b7vx1eHbfasppRnFJk6saYsEIU6Psxa8uQcEa+vew9\r\nlOaG5QQNCSVMwLroAkSAqu0OgcyEzfnNYqEOd+U+vywdIUf2J4wGbf7vJHYa\r\n6WTqMp9tqDM4Y2Q9xz5xspJYxa2P6inka6s7zDzk+zZ4gSuYtoNx+jDmvHSG\r\nysjNUWhBCFy/3/tuQPVlkzEmpL3tblfGoGkUJ7ilIZWenlGSarw+KVdrz+na\r\nFlyuraC+C83mt1U5J2llATpRZnsHbXzDaEVAASYTudB4SoEviSvItEqB51ku\r\nbcFGdEG08GTHufWBVk4AWiYXLb+AwvFr7LA=\r\n=V09C\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dhar","email":"olivier@audard.net"},"maintainers":[{"name":"dhar","email":"olivier@audard.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/url-courte_1.0.0_1674258123520_0.590547426584326"},"_hasShrinkwrap":false},"2.0.0":{"name":"@dhar/url-courte","version":"2.0.0","description":"My own super simple algorithmically reversible, personal URL shortener.","type":"module","main":"index.js","scripts":{"test":"node ./test/url-courte.test.js"},"keywords":["'URL","Shortener'","url","shortener"],"author":{"name":"Olivier Audard","email":"olivier@audard.net"},"directories":{"lib":"lib","test":"test"},"repository":{"type":"git","url":"git+https://github.com/dharFr/url-courte.git"},"license":"MIT","bugs":{"url":"https://github.com/dharFr/url-courte/issues"},"homepage":"https://github.com/dharFr/url-courte#readme","devDependencies":{"cli-color":"^2.0.3"},"gitHead":"26f0d206c275cf3cfd1c49605641cd091cd7e125","_id":"@dhar/url-courte@2.0.0","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-bpGNAHToENDM1j93FfIj5PfcmjGLzYcV64xFOYFqujgffkDDZ9rnWjXGIsmmIZ15YiKmfky3Cfge6NSwVbxbpg==","shasum":"6758c5989733bf20772ce4bfa61934a631806965","tarball":"https://registry.npmjs.org/@dhar/url-courte/-/url-courte-2.0.0.tgz","fileCount":8,"unpackedSize":7430,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCd+EAArSO8NfwioK3A2WFJdmNCchGdGjgz4TkAA81STwIhAIsy+onGT35nPaBhrUaC5xbya70eIjGMsaoqFJKxfBIF"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj0r0QACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqGlA/+LMckwCJ38CtBOq6bKNPjnv3qfABBgIj6DkDVXlVenAqmWBSj\r\n6Ji4dLN7K/nkPGLsHi/SFQV95+U5Tt0hVK7sl/SmOBmOFb1K8FmxLidCBe4U\r\nX4qO/olHybp+GRPUdFZDTloIiYmgMMNp6VM9HSqVGUbkVz74z/c7K/2Q53r9\r\npuK6UTsmpysLhv6N1jYjG2XD/XT6Jkjq/BaSUHlOoxbR4IaH/6XxnT3a449a\r\n2GD4CVwmMk1mkMSDMRrTOec137PiBdEcifPQL2Sf1fzRX5v/hNdeEIouPszr\r\n9pT911OHKmxzkRB910VRF809cqdN2Vff/MC+Rf1F1HVwHgjWWCKqkhB3NL3f\r\n+aCOMUMhqf//W8n1wRdUKaOVQ8kcE7F+aa/+7qYttQ7CeexwBLkmsfGJdQpO\r\nLgPuBPcVP54PUKoLXttv+14jluZ+WKKW1Puufm453oaA/0IUgsJ4bXCE1CJC\r\neBoZLE0Hy8qInhdk4WyFy110/eJon2hTL/4Uaf8HgYAj55ZaBmZBjuhCNojS\r\nx9rV/7v/XranR9ms2lz9MrnOmpuhd/rz2CjMcIk8oXN6Z667tFDq6+iVcftC\r\nxfjljC2D7l7UbV9epxa1Uz0DkrtdmdqqtaJkaBh3j8iBvifEsHgNtMF+nC55\r\nPAVhQXEJYoC6SDfA8wlRlOW+J/+b7SWpjwE=\r\n=Pkg6\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dhar","email":"olivier@audard.net"},"maintainers":[{"name":"dhar","email":"olivier@audard.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/url-courte_2.0.0_1674755344140_0.003106840615897166"},"_hasShrinkwrap":false}},"time":{"created":"2023-01-20T23:42:03.441Z","1.0.0":"2023-01-20T23:42:03.687Z","modified":"2023-01-26T17:49:04.364Z","2.0.0":"2023-01-26T17:49:04.291Z"},"maintainers":[{"name":"dhar","email":"olivier@audard.net"}],"description":"My own super simple algorithmically reversible, personal URL shortener.","homepage":"https://github.com/dharFr/url-courte#readme","keywords":["'URL","Shortener'","url","shortener"],"repository":{"type":"git","url":"git+https://github.com/dharFr/url-courte.git"},"author":{"name":"Olivier Audard","email":"olivier@audard.net"},"bugs":{"url":"https://github.com/dharFr/url-courte/issues"},"license":"MIT","readme":"# url-courte\n\nMy own super simple algorithmically reversible, personal URL shortener.\n\n[![npm](https://img.shields.io/npm/v/@dhar/url-courte.svg)](https://www.npmjs.com/package/@dhar/url-courte)  [![npm](https://img.shields.io/npm/l/@dhar/url-courte.svg)](https://github.com/dharFr/url-courte/blob/main/LICENSE)\n\nInpired by :\n - [Whistle](http://tantek.pbworks.com/w/page/21743973/Whistle) \n - https://indieweb.org/permashortlink\n - https://www.npmjs.com/package/whistler\n\n\n## Installation\n\n```\nnpm install @dhar/url-courte\n```\n\n## Usage\n\n### `shorten(date, category, ordinal)`\n\nConverts a published date, category, and ordinal into a _url-courte_ URL fragment.\n\n``` js\nimport { shorten } from '@dhar/url-courte'\n\nconst d = new Date('2023-02-03')\nconst shortenedFragment = shorten('articles', d, 1)\n// --> returns 'a202302031'\n```\n\n#### parameters\n\n - `category`: named category, typically something like 'articles', 'notes', 'pictures', or anything that make sense on your website/blog\n - `date`: A JS Date object, typically the publication date.\n - `ordinal`: a digit to indicate the nth ordinal post of that type for that day\n\n### `expand(fragment, [categoryMapping])`\n\nConverts a shortened URL fragment (i.e. 'a202301082') into an expanded _url-courte_ URL fragment (i.e. 'articles/2023/01/08/2').\nReturn an empty string if the provided fragment doesn't match the expected format.\n\n``` js\nimport { expand } from '@dhar/url-courte'\n\nconst d = new Date('2023-02-03')\nconst expandedFragment = expand('a202301182', {\n\t'a': 'articles',\n\t'n': 'notes',\n})\n// --> returns 'articles/2023/01/18/2'\n```\n\n#### parameters\n\n - `fragment`: the short URL fragment to expand\n - `categoryMapping` (optional): A mapping to match the first letter of the fragment. If ommitted, the single letter from the fragment is used.\n\n\n\n","readmeFilename":"README.md"}