Skip to content

Instantly share code, notes, and snippets.

View SZharkov's full-sized avatar
😎

Serhii SZharkov

😎
View GitHub Profile
@SZharkov
SZharkov / almostIncreasingSequence.js
Created September 27, 2020 16:06 — forked from ryanSN/almostIncreasingSequence.js
Javascript almost increasing sequence
function almostIncreasingSequence(sequence) {
var found = false;
for (var i=0;i<sequence.length;i++) {
if(sequence[i] <= sequence[i-1]) {
if(found) {
return false;
}
found = true;
if(i === 1 || i + 1 === sequence.length) {
// import functions from the package
import { SitemapStream, streamToPromise } from "sitemap";
// A custom function I use to fetch data from a backend. I will keep the import to make it more clear why "graphlqlFetch" is used in the code
import graphlqlFetch from "lib/apollo"
export default async (req, res) => {
// Fetch data from a source which will be used to render the sitemap.
const { posts } = await graphlqlFetch(`
query getSitemapData {