Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
insertionTargetSelection = insertionTargetBlock.getSelectionAfter();
}
const fragmentArray = [];
if (insertData) {
// creating a new ContentBlock including the entity with data
// Entity will be created with a specific type, if defined, else will fall back to the ContentBlock type
const {text, data, entity} = insertData;
let characterList = Immutable.List();
type = insertData.type;
if (entity) {
currentContentState = currentContentState.createEntity(entity.type || type, entity.mutability, entity.data);
const entityKey = currentContentState.getLastCreatedEntityKey();
const charData = Draft.CharacterMetadata.create({entity: entityKey});
characterList = Immutable.List(Immutable.Repeat(charData, text.length || 1));
}
fragmentArray.push(
new Draft.ContentBlock({
key: Draft.genKey(),
type,
text,
data,
characterList // eslint-disable-line new-cap
})
);
}
// new content block so we can continue writing right away after inserting the block
fragmentArray.push(
new Draft.ContentBlock({
const styles = node[dataSchema.inline.styles]
const text = node[dataSchema.inline.text]
// Convert the styles into an OrderedSet
const style = OrderedSet(
styles.map((style) => style)
)
// Create a List that has the style values for each character
let charMetadata = CharacterMetadata.create({
style,
entity: opts.entityKey || null,
})
// We want the styles to apply to the entire range of `text`
let characterMeta = Repeat(charMetadata, text.length)
const characterList = characterMeta.toList()
return {
text,
characterList,
}
},
}
const newTradesCount = action.tradesCount;
const countDiff = newTradesCount - oldTradesCount;
const amountDefault = getAmountDefault(root && root.account);
if (amountDefault !== defaultParams.amountDefault) {
defaultParams.amount = amountDefault;
defaultParams.amountDefault = amountDefault;
state = state.map(s => s.set('amount', amountDefault));
}
if (countDiff > 0) {
const { assetChoices } = action;
if (assetChoices && assetChoices.length < countDiff) {
throw new Error('Not enough asset choices to create more trade');
}
const additionalTradeParams = Repeat(fromJS(defaultParams), countDiff); // eslint-disable-line new-cap
if (assetChoices) {
return state
.concat(additionalTradeParams.map((v, i) => v.set('symbol', assetChoices[i])));
}
return state.concat(additionalTradeParams);
}
if (countDiff < 0) {
return state.take(newTradesCount);
}
return state;
}
case UPDATE_TRADE_PARAMS: {
Seq(placement).flatMap(piece => (
/^\d$/.test(piece) ? Repeat('-', parseInt(piece, 10)) : piece
)).toArray() :
const combinationDataTable = (cleanData: Data): any[] => {
let raceSet = Set(cleanData.map(race)).toArray().sort();
raceSet = raceSet.length > 0
? raceSet
: ['Black or African American', 'White', 'Unknown'];
const headers = ['Gender-Age', ...raceSet];
const defaultsByRace = Map(List(raceSet).zip(Repeat(0)));
let data = cleanData
.groupBy(genderAndAge)
.sort()
.map(group => group
.groupBy(race)
.map(sumData)
.toMap()
.mergeWith((old, _) => old, defaultsByRace)
.sort()
.valueSeq()
.toArray()
)
.map((val, key) => [key, ...val])
.valueSeq()
.toArray();
processText(text: string) {
let block = this.blockStack.slice(-1)[0];
let style = block.styleStack.slice(-1)[0];
let entity = block.entityStack.slice(-1)[0];
let charMetadata = CharacterMetadata.create({
style: style,
entity: entity,
});
let seq: CharacterMetaSeq = Repeat(charMetadata, text.length);
block.textFragments.push({
text: text,
characterMeta: seq,
});
}
processText(text: string) {
let block = this.blockStack.slice(-1)[0];
let style = block.styleStack.slice(-1)[0];
let entity = block.entityStack.slice(-1)[0];
let charMetadata = CharacterMetadata.create({
style: style,
entity: entity,
});
block.textFragments.push({
text: text,
characterMeta: Repeat(charMetadata, text.length),
});
}
static unwind(botGroupConfig: BotGroupConfig) {
return Repeat(botGroupConfig.tankLevel, botGroupConfig.count)
}
const contentBlocksArray = linesFromText.map(line => {
return new ContentBlock({
key: genKey(),
type: currentBlockType,
characterList: new List(Repeat(CharacterMetadata.create(), line.length)),
text: line,
});
});
processText(text: string) {
let block = this.blockStack.slice(-1)[0];
let style = block.styleStack.slice(-1)[0];
let entity = block.entityStack.slice(-1)[0];
let charMetadata = CharacterMetadata.create({
style: style,
entity: entity,
});
let seq: CharacterMetaSeq = Repeat(charMetadata, text.length);
block.textFragments.push({
text: text,
characterMeta: seq,
});
}