var options = {
root: document.querySelector('#scrollArea'),
rootMargin: '0px',
threshold: 1.0
}
var callback = function(entries, observer) {
/* Content excerpted, show below */
};
var observer = new IntersectionObserver(callback, options);
function bindActionCreator(actionCreator, dispatch) {
return function () {
return dispatch(actionCreator.apply(this, arguments));
};
}
function () {
return dispatch(actionCreator.apply(this, arguments));
};
camera-orbit="45deg 55deg 2.5m"
const cheerio = require('cheerio')
const xml = `
<offer internal-id="12345">
<living-space>
<value>31</value>
<unit>кв. м</unit>
</living-space>
<kitchen-space>
<value>11</value>
<unit>кв. м</unit>
</kitchen-space>
<image>https://example.website.yandexcloud.net/files/ycKZLv7B0GUZled.jpg</image>
<image>https://example.website.yandexcloud.net/files/ycKZLv7B0GUZled.jpg</image>
</offer>
`
async function main() {
try {
let $ = await cheerio.load(xml, {
xmlMode: true
})
let title = $('image').text()
console.log('title', title)
} catch (e) {
console.log(e)
}
}
main()
const endLine = '\r\n'; // если Windows
let lineArray = String( fs.readFileSync( 'price.txt' ) ).split( endLine );
// что-то делаем с полученными строками
// ...
let file = lineArray.join( endLine ) // соединяем обратно в целый файл
for (let i = 0; i < arr.length; i ++)
const records =[
{'name' :'Pink Floyd The Dark Side of the Moon'},
{'year': '1973'},
{'country': 'london'},
{'date': 'March 24'},
{'type':'music album'},
{'name' :'Dark Side of the Moon'},
{'year': '1986'},
{'country': 'paris'},
{'date': 'March 14'},
{'type':'video album'},
]
// сначала разбиваем на массив по 5 объектов
const nz = records.reduce((acc,c,i,arr) => {
if ((i % 5) === 0) acc.push([]);
acc[acc.length - 1].push(c);
return acc;
}, [])
// затем сливаем объекты
const rez = nz.map(ob=>{
return Object.assign({}, ...ob)
})
// результат
console.log(rez)