Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
assert.oequal(
await runAndGivePositions(indexes, {
orderBy: { field: 'createdAt' },
before: cursors.get(2),
}),
Range(0, 2),
'only before'
);
assert.oequal(
await runAndGivePositions(indexes, {
orderBy: { field: 'createdAt' },
after: cursors.get(1),
before: cursors.get(5),
}),
Range(2, 5),
'before and after'
);
// XXX(freiksenet, 2015-08-12): this is not strictly compliant to
// relay spec, that asks to not apply one of the cursors if they are
// disjoint.
assert.oequal(
await runAndGivePositions(indexes, {
orderBy: { field: 'createdAt' },
before: cursors.get(1),
after: cursors.get(5),
}),
List(),
'disjoint before and after'
);
});
if (data instanceof Immutable.Map)
return [k, data.get(k).copy()];
throw new Error('Data is not Map');
}));
this.set_axis(1, this._data.keySeq());
this.set_axis(0, this._data.get(this.columns.get(0)).index);
} else if (data instanceof Immutable.List) { // List of List of row values
let columns;
if (Array.isArray(kwargs.columns) || kwargs.columns instanceof Immutable.Seq)
columns = Immutable.List(kwargs.columns);
else if (kwargs.columns instanceof Immutable.List)
columns = kwargs.columns;
else if (typeof kwargs.columns === 'undefined')
columns = Immutable.Range(0, data.get(0).size).toList();
else
throw new Error('Invalid columns');
this._values = data; // Cache the values since we're in List of List or row data already
this._data = Immutable.OrderedMap(columns.map((c, colIdx) =>
([c, new Series(data.map(row => row.get(colIdx)), {index: kwargs.index})])));
this.set_axis(1, this._data.keySeq());
this.set_axis(0, this._data.get(this.columns.get(0)).index);
} else if (typeof data === 'undefined') {
this._data = Immutable.Map({});
this.set_axis(0, Immutable.List.of());
this.set_axis(1, Immutable.Seq.of());
}
this._setup_axes(Immutable.List.of(0, 1));
function ImmutableListViewExample() {
return (
data.setIn(['Section A', 1], 'This value was changed!')}
extraPropsA={{
renderSectionHeader: utils.renderSectionHeader,
}}
initialDataB={Immutable.Range(1, 100)}
dataMutatorB={(data) => data.toSeq().map((n) => n * 2)}
/>
);
}
renderPhotos() {
const { msg } = this.props;
const photosArray = Range(1, 17).map(i => this.renderPhoto(i));
return (
<img style="{styles.photos.cooperation}" src="{require('./images/cooperation.png')}" alt="{msg('Coopertion')}">
<div style="{styles.photos.innerWrapper}">
{photosArray}
</div>
);
}
import * as React from "react"
import * as ReactDOM from "react-dom"
import {List, Map, Set, Range} from "immutable"
import * as Immutable from "immutable"
import * as Moment from 'moment'
import {UrlTemplate, application, get_context, Route, Url, make_url, fallback_url, link_to_route,
Option, C, Mode, unit, bind, string, number, bool, button, selector, multi_selector, label, h1, h2, div, form, image, link, file, overlay,
custom, repeat, all, any, lift_promise, retract, delay,
simple_menu, mk_menu_entry, mk_submenu_entry, MenuEntry, MenuEntryValue, MenuEntrySubMenu,
rich_text, paginate, Page, list, editable_list} from '../../../src/monadic_react'
export let list_sample : C =
list(Range(1,10).toList(), `list sample`)(
i => n => string("view", "text", `item-${i}-${n}`)(`This is item ${i}/${n}`).ignore(`ignore-${i}-${n}`)
)
import * as React from "react"
import * as ReactDOM from "react-dom"
import {List, Map, Set, Range} from "immutable"
import * as Immutable from "immutable"
import {UrlTemplate, application, get_context, Route, Url, make_url, fallback_url, link_to_route,
Option, C, Mode, unit, bind, string, number, bool, button, selector, multi_selector, label, h1, h2, div, form, image, link, file, overlay,
custom, repeat, all, any, lift_promise, retract, delay,
simple_menu, mk_menu_entry, mk_submenu_entry, MenuEntry, MenuEntryValue, MenuEntrySubMenu,
rich_text, paginate, Page, list, editable_list} from '../../../src/monadic_react'
type FictionalPage = { title:string, content:string }
export let tabbed_menu_sample : C =
simple_menu({kind:"tabs",max_tabs:5}, p => p.title, `tabbed menu`)(
Range(1, 10).map(i =>
({ title:`Tab ${i}`, content:`This is the content of the tab ${i}.`})
).map>(s => ({ kind:"item", value:s})).toArray(),
p => string("view")(p.content)
).ignore()
function findAvailableCell(state, tile, direction) {
let available;
const {axis, value} = getCurrent(direction);
const from = tile.get(axis);
const to = value < 0 ? (SIZE - 1) : 0;
Range(to, from).forEach(index => {
const path = (
axis === "x" ?
["grid", index, tile.get("y")] :
["grid", tile.get("x"), index]
);
const cell = state.getIn(path);
if (!isSuitable(cell, tile)) {
available = null;
return;
}
if (tile.get("value") === "x") {
if (cell.size === 1 || (!cell.size && !available)) available = path;
} else {
function _modifySithIDs(state, n, f) {
var sithIDs = state.sithIDs;
immutable_1.Range(0, n).forEach(function () {
sithIDs = f(sithIDs);
});
return cleanCache(discoverSiths(util_1.assoc(state, { sithIDs: sithIDs })));
}
function down(state, n) {
_getKeyList: function() {
var keyStart = this.state.keyStart;
var basicRange = Immutable.Range(0, this.props.renderCount);
return basicRange.slice(keyStart).toList().concat(basicRange.slice(0, keyStart).toList())
},
function splitIntoGroups(list, chunkSize) {
return Range(0, list.count(), chunkSize)
.map(chunkStart => list.slice(chunkStart, chunkStart + chunkSize))
}