mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-10-23 04:52:14 +00:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8158f29d62 | ||
|
830c11f2a8 | ||
|
c484715c3e | ||
|
0812385ada | ||
|
f6d8dc41e6 | ||
|
e51a37844a | ||
|
6d8db0a5d5 | ||
|
84e727a43a | ||
|
6f7c399823 | ||
|
3777eb941d | ||
|
dd41bdc57c |
@@ -4,6 +4,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Next
|
||||
- [fix] [UuidGenerator] added quantity validation rules
|
||||
- [refactor] better isInt checker
|
||||
|
||||
## 1.2.0
|
||||
- [feat] [UuidGenerator] can generate multiple uuids
|
||||
|
||||
## 1.1.0
|
||||
- [feat] 404 route + page
|
||||
- [feat] changelog in the About page
|
||||
- [feat] contributors list in the About page
|
||||
|
@@ -23,7 +23,6 @@ Here is an unordered list of the current functionalities, and some that may come
|
||||
- [ ] Image format converter?
|
||||
- [ ] Image cropper
|
||||
- [ ] Image resizer
|
||||
- [ ] 404 page
|
||||
- [ ] HTTP client (w/ axios)
|
||||
|
||||
You have an idea of a tool? Submit a feature request!
|
||||
|
8
package-lock.json
generated
8
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "it-tools",
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -12741,9 +12741,9 @@
|
||||
}
|
||||
},
|
||||
"websocket-extensions": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz",
|
||||
"integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==",
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz",
|
||||
"integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==",
|
||||
"dev": true
|
||||
},
|
||||
"which": {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "it-tools",
|
||||
"description": "",
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
|
@@ -3,27 +3,52 @@
|
||||
<v-card-title>Uuid v4 generator</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-text-field outlined v-model="token" class="centered-input"/>
|
||||
<v-text-field
|
||||
outlined
|
||||
v-model="quantity"
|
||||
ref="quantity"
|
||||
type="number"
|
||||
label="Quantity"
|
||||
dense
|
||||
class="quantity"
|
||||
:rules="rules.quantity"
|
||||
/>
|
||||
<v-textarea outlined v-model="token" class="centered-input" :rows="quantity <= 10 ? quantity : 10"
|
||||
readonly/>
|
||||
|
||||
<div class="text-center">
|
||||
<v-btn @click="refreshBool = !refreshBool" depressed class="mr-4">Refresh</v-btn>
|
||||
<v-btn @click="copyToken()" depressed>Copy token</v-btn>
|
||||
<v-btn @click="copyToken()" depressed>Copy uuid{{ quantity > 1 ? 's' : ''}}</v-btn>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {copyToClipboard} from "../../utils/helpers";
|
||||
import {copyToClipboard, isInt} from "../../utils/helpers";
|
||||
|
||||
const noop = () => {
|
||||
};
|
||||
|
||||
const generateUuid = () => ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16));
|
||||
|
||||
export default {
|
||||
name: "UuidGenerator",
|
||||
data: () => ({
|
||||
refreshBool: true
|
||||
refreshBool: true,
|
||||
quantity: 1,
|
||||
rules: {
|
||||
quantity: [
|
||||
v => !!v || 'Quantity is required',
|
||||
v => (v > 0 && v <= 50 ) || 'Quantity should be > 0 and <= 50',
|
||||
v => isInt(v) || 'Quantity should be an integer'
|
||||
]
|
||||
},
|
||||
isMounted:false
|
||||
}),
|
||||
mounted() {
|
||||
this.isMounted = true;
|
||||
},
|
||||
methods: {
|
||||
copyToken() {
|
||||
copyToClipboard(this.token);
|
||||
@@ -32,16 +57,32 @@
|
||||
},
|
||||
computed: {
|
||||
token() {
|
||||
if (this.refreshBool) noop(); // To force recomputation
|
||||
if (this.isMounted && this.$refs.quantity.validate()) {
|
||||
if (this.refreshBool) noop(); // To force recomputation
|
||||
|
||||
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16));
|
||||
return Array.from({length: this.quantity}, generateUuid).join('\n');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
::v-deep .centered-input input {
|
||||
text-align: center
|
||||
<style scoped lang="less">
|
||||
.quantity {
|
||||
width: 100px;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
|
||||
::v-deep input {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .centered-input textarea {
|
||||
text-align: center;
|
||||
margin-top: 13px !important;
|
||||
font-family: Consolas, monospace;
|
||||
}
|
||||
</style>
|
@@ -25,7 +25,7 @@ const formatBytes = (bytes, decimals = 2) => {
|
||||
}
|
||||
|
||||
const isInt = (value) => {
|
||||
return !isNaN(value) && ((x) => (x | 0) === x)(parseFloat(value))
|
||||
return Number.isInteger(value);
|
||||
}
|
||||
|
||||
export {
|
||||
|
Reference in New Issue
Block a user