Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | 1x 1x 22x 22x 1x 1x 7x 7x 7x 2x 7x 1x 1x 7x 7x 7x 7x 7x 7x 7x 7x 1x 1x 3x 3x 3x 1x 3x 1x 1x 3x 3x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1860x 1860x 12x 12x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 1x 1x 2x 2x 2x 3720x 1632x 2126x 1632x 1632x 2x 2x 2x 2x 1x 1x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x | export class System {
constructor(pure) {
this.pure = pure;
}
fileName(ext) {
let def = ext;
if (typeof ext === 'undefined') {
def = this.pure.system.fileExt();
} else if (ext[0] === '.') {
def = ext.substr(1, ext.length);
}
let str = `${this.pure.random.words()}.${def}`;
str = this.pure.helpers.slugify(str);
str = str.replace(/\s\\\/-,/g, '_');
str = str.toLowerCase();
return str;
}
commonFileName(ext) {
let def = ext;
if (typeof ext === 'undefined') {
def = this.pure.system.commonFileExt();
} else if (ext[0] === '.') {
def = ext.substr(1, ext.length);
}
return this.pure.system.fileName(def);
}
mimeType() {
return this.pure.random.arrayElement(Object.keys(this.pure.registeredModules.system.mimeTypes));
}
commonFileType() {
const types = ['video', 'audio', 'image', 'text', 'application'];
return this.pure.random.arrayElement(types);
}
commonFileExt() {
const types = [
'application/pdf',
'audio/mpeg',
'audio/wav',
'image/png',
'image/jpeg',
'image/gif',
'video/mp4',
'video/mpeg',
'text/html'
];
return this.pure.system.fileExt(this.pure.random.arrayElement(types));
}
fileType() {
const types = [];
const mimes = this.pure.registeredModules.system.mimeTypes;
Object.keys(mimes).forEach(m => {
const parts = m.split('/');
if (types.indexOf(parts[0]) === -1) {
types.push(parts[0]);
}
});
return this.pure.random.arrayElement(types);
}
fileExt(mimeType) {
const exts = [];
const mimes = this.pure.registeredModules.system.mimeTypes;
// get specific ext by mime-type
if (typeof mimes[mimeType] === 'object') {
return this.pure.random.arrayElement(mimes[mimeType].extensions);
}
// reduce mime-types to those with file-extensions
Object.keys(mimes).forEach(m => {
if (mimes[m].extensions instanceof Array) {
mimes[m].extensions.forEach(ext => {
exts.push(ext);
});
}
});
return this.pure.random.arrayElement(exts);
}
directoryPath() {
return this.pure.random.arrayElement(this.pure.registeredModules.system.directoryPaths);
}
filePath() {
return `${this.pure.system.directoryPath()}/${this.pure.system.fileName()}`;
}
semver() {
return this.pure.helpers.replaceSymbolWithNumber({ string: '#.#.#' });
}
}
|