const path = require('path');
const glob = require('glob');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const config = {};
glob.sync(`${basePath}/src/layouts/*.?(pug|jade)`).forEach(item => {
config.plugins.push(
new HtmlWebpackPlugin({
filename: `${path.basename(item, path.extname(item))}.html`,
template: item
})
});
Этот код не работает. Совсем.
test: function() { _.debounce(function() { console.log('test222'); }, 500); }
test: _.debounce(function() {
console.log('test222');
}, 500)
var l={
list: {
"action_buttons[0]": "View",
"action_buttons[1]": "Share",
"action_buttons[2]": "Download",
"columns[0]": "Date of Study",
"columns[1]": "Patient",
"columns[2]": "File name",
"columns[3]": "Reporting <br>Physician",
"columns[4]": "Institution"
}
};
var n = {};
for (var item in l.list) {
if (l.list.hasOwnProperty(item)) {
r = item.replace(/\[\d\]/,'');
if(n[r]==undefined){ n[r]=[] }
n[r].push(l.list[item]);
}
}
l.list = n;
console.log(l);
const result = {};
const list = {
"action_buttons[0]": "View",
"action_buttons[1]": "Share",
"action_buttons[2]": "Download",
"columns[0]": "Date of Study",
"columns[1]": "Patient",
"columns[2]": "File name",
"columns[3]": "Reporting <br>Physician",
"columns[4]": "Institution"
};
Object.keys(list).forEach(key => {
const value = list[key];
const combinedKey = key.replace(/\[.+\]/, '');
if (Array.isArray(result[combinedKey])) {
result[combinedKey].push(value);
} else {
result[combinedKey] = [value];
}
});
console.log(result);
var t = {
list: {
"action_buttons[0]": "View",
"action_buttons[1]": "Share",
"action_buttons[2]": "Download",
"columns[0]": "Date of Study",
"columns[1]": "Patient",
"columns[2]": "File name",
"columns[3]": "Reporting <br>Physician",
"columns[4]": "Institution"
}
};
var list = {};
var re = /^(.*?)\[(\d+)\]$/;
var match;
for (var prop in t.list) {
match = prop.match(re);
if (typeof list[match[1]] == "undefined") {
list[match[1]] = [];
}
list[match[1]][match[2]] = t.list[prop];
}
t.list = list;
console.log(t);
{…}
list: {…}
action_buttons: […]
0: "View"
1: "Share"
2: "Download"
columns: […]
0: "Date of Study"
1: "Patient"
2: "File name"
3: "Reporting <br>Physician"
4: "Institution"
а как на самом деле дела обстоят — есть достоверная информация по браузерам?А на самом деле, есть тесты, например вот такой, а так же здравый смысл, который подсказывает, что размер куки >4Кб - в подавляющем большинстве случаев говорит о серьёзных ошибках разработчика.