Merge branch 'master' of https://github.com/MozillaSecurity/octo
This commit is contained in:
commit
81ec8a9891
3 changed files with 25 additions and 26 deletions
|
@ -12,12 +12,12 @@ make.datetime = {
|
|||
}
|
||||
},
|
||||
date: function () { // eslint-disable-line no-unused-vars
|
||||
return this.datetime.object().toDateString()
|
||||
return this.object().toDateString()
|
||||
},
|
||||
time: function () { // eslint-disable-line no-unused-vars
|
||||
return this.datetime.object().toTimeString()
|
||||
return this.object().toTimeString()
|
||||
},
|
||||
iso: function () { // eslint-disable-line no-unused-vars
|
||||
return this.datetime.object().toISOString()
|
||||
return this.object().toISOString()
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5,28 +5,32 @@
|
|||
utils.mutate = {
|
||||
text: function (str) {
|
||||
let mutator = function (m) {
|
||||
return random.number(4) === 1 ? m : make.text.any()
|
||||
return random.chance(4) ? m : make.text.any()
|
||||
}
|
||||
return str.replace(/[a-zA-Z]+?/g, mutator)
|
||||
},
|
||||
|
||||
numbers: function (str) {
|
||||
let mutator = function (m) {
|
||||
return random.number(4) === 1 ? m : make.number.any()
|
||||
return random.chance(4) ? m : make.number.any()
|
||||
}
|
||||
return str.replace(/-?\d+(\.\d+)?/g, mutator)
|
||||
},
|
||||
|
||||
units: function (str) {
|
||||
let mutator = function (m) {
|
||||
return random.number(4) === 1 ? m : make.unit.unit()
|
||||
let mutator = function (m, p1) {
|
||||
if (random.chance(4)) {
|
||||
return m
|
||||
} else {
|
||||
return p1 + make.unit.unit()
|
||||
}
|
||||
}
|
||||
return str.replace(/(px|em|ex|ch|rem|mm|cm|in|pt|pc|%')/g, mutator)
|
||||
return str.replace(/(\d+)(px|em|ex|ch|rem|mm|cm|in|pt|pc|%')/g, mutator)
|
||||
},
|
||||
|
||||
random: function (str) {
|
||||
let mutator = function (m) {
|
||||
if (random.number(20) === 1) {
|
||||
if (random.chance(20)) {
|
||||
if (str.match(/[0-9]/g)) {
|
||||
return make.number.any()
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue