├── index.js ├── test.js ├── README.md ├── package.json └── LICENSE /index.js: -------------------------------------------------------------------------------- 1 | /* jshint esversion:6 */ 2 | 3 | module.exports=i=>i.substr(0,8)+"-"+i.substr(8,4)+"-"+i.substr(12,4)+"-"+i.substr(16,4)+"-"+i.substr(20); 4 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | console.time("test"); 2 | require("assert").strictEqual("e0603b59-2edc-45f7-acc7-b0cccd6656e1", require("./index.js")("e0603b592edc45f7acc7b0cccd6656e1")); 3 | console.timeEnd("test"); 4 | // Yes that's right, there's no testing framework used except for nodejs built-ins. 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # add-dashes-to-uuid 2 | 3 | Converts a UUID string to a UUID string with dashes. 4 | 5 | require("add-dashes-to-uuid")("e0603b592edc45f7acc7b0cccd6656e1"); // e0603b59-2edc-45f7-acc7-b0cccd6656e1 6 | 7 | This behaviour can easily be verified: 8 | 9 | git clone https://github.com/timmyrs/add-dashes-to-uuid 10 | cd add-dashes-to-uuid 11 | cat test.js 12 | node test.js 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "add-dashes-to-uuid", 3 | "version": "1.0.0", 4 | "description": "Converts a UUID string to a UUID string with dashes.", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "node test.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/timmyrs/add-dashes-to-uuid.git" 12 | }, 13 | "keywords": [ 14 | "uuid" 15 | ], 16 | "author": "Tim \"timmyRS\" Speckhals", 17 | "license": "MIT", 18 | "bugs": { 19 | "url": "https://github.com/timmyrs/add-dashes-to-uuid/issues" 20 | }, 21 | "homepage": "https://github.com/timmyrs/add-dashes-to-uuid#readme" 22 | } 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Tim "timmyRS" Speckhals 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------