const user_balance = () => {
return new Promise((resolve, reject) => {
Wallet.getBalance((err, balance) => {
if (err) {
reject(err);
} else {
const data = balance.accounts[0].balance.amount;
resolve(data);
}
});
});
}
user_balance()
.then((data) => {
console.log(data);
}).catch((err) => {
console.error(err);
});
const data = {
firstbox: ["-16","13"],
secondbox: ["-10","11"]
};
$('.box').mousemove(function() {
const [x, y] = data[this.classList[1]];
gsap.to($(this), 1, {x, y});
});
const attachType = 'photo';
obj.attachType // вернёт obj.attachType
obj[attachType] // вернёт obj.photo
const attachments = content.attachments
.map((o) => `${o.type}${o[o.type].owner_id}_${o[o.type].id}`)
.join(',');
function modifyApi(api) {
const wrappedApi = {};
for (const prop in api) {
if (typeof api[prop] === 'number') {
let value = api[prop];
Object.defineProperty(wrappedApi, prop, {
get() {
return ++value;
}
});
} else if (!Array.isArray(api[prop]) && typeof api[prop] === 'object') {
wrappedApi[prop] = modifyApi(api[prop]);
} else {
wrappedApi[prop] = api[prop];
}
}
return wrappedApi;
}
const traversal = (arr, prevKey, key) => arr.map((o) => {
const newObj = {
...o,
[key]: o[prevKey],
children: traversal(o.children, prevKey, key)
};
delete newObj[prevKey];
return newObj;
});
const newArr = traversal(data, 'name', 'key');
const gallerySlider = new Swiper(galleryBoxSlider, {
effect: 'fade',
speed: 1000,
simulateTouch: false
});
return {
...state,
articles: state.articles.map(({comments, ...o}) => ({
...o,
comments: comments.filter((c) => c.id !== action.id)
}))
};
$('#second-check').change(function() {
const href = $(this).prop('checked') ?
'https://google.com/' :
'https://youtube.com/';
$('a').attr('href', href);
});