const os = require('os'),
path = require('path'),
fs = require('fs'),
kb = require('../modules/keyboards.js'),
config = require('../config.js');
module.exports = { os, path, fs, kb, config }
const mocked = await getMockedClient ().then(prop => prop.mockedClient())
getMockedClient ().then(prop => {
const mocked = getMockedClient ()
// И тут делаете с полученным значением что хотите
})
$s1 = 'Lorem {val1} dolor sit {val2}, consectetur adipisicing {val3}.';
$s2 = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.';
$patterns = [];
$pattern2 = preg_replace_callback('|\{([a-z0-9]+)\}|', function($m) use (&$patterns) {
$patterns[] = $m[1];
return '(.*)';
}, $s1);
preg_match('|' . $pattern2 . '|', $s2, $matches);
$res = array_combine($patterns, array_slice($matches, 1));
var_dump($res);
const str = `
RAM_smith_T1:0 "Anführer von Amerika"
RAM_smith_T2:0 "Popular"
RAM_smith_T3:0 "Suppressor of the Resistance"
RAM_smith_T4:0 "Folower of the Reich's Orders"
RAM_smith_T5:0 "Tied by German Oligarchy"
umc_leader_john_smith_ram_desc:0 ""`
const regExp = (/:0 "([^"]+)"/ig)
let found
while (found = regExp.exec(str)) {
console.log(found[1])
}
onMouseMove={e => { this.mouse = { clientX: e.clientX, clientY: e.clientY }} }
const rect = document.querySelector('.Message').getBoundingClientRect()
if (this.mouse.clientX < rect.left ||
this.mouse.clientX > rect.right ||
this.mouse.clientY < rect.top ||
this.mouse.clientY > rect.bottom) {
this.disable()
}
document.querySelector('.Message')
arr[i] % 0 +`${s}`+ 0
function getSameParity(arr){
const newArr = [];
let s = arr[0] % 2;
for(let i = 0; i < arr.length; i += 1){
if(arr[i] % 2 === s){
newArr.push(arr[i]);
}
}
return newArr;
}
console.log(getSameParity([3, 6, 7, 8])) // [3, 7]
console.log(getSameParity([4, 6, 7, 8])) // [4, 6, 8]
const getSameParity = arr => arr.filter(v => v % 2 === arr[0] % 2)
const range = arr => arr
.sort((a, b) => a - b)
.reduce((agg, v) => {
const currRange = agg[agg.length - 1]
if (!currRange || v > currRange.last + 1) {
agg.push({first: v, last: v})
} else {
currRange.last = v
}
return agg
}, [])
.map(v => v.first + (v.first !== v.last ? '-' + v.last : '')).join()