Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
decodeInlineStyleRanges.js
Browse files Browse the repository at this point in the history
Summary: No changes to behaviour, only types. ez ¯\_(ツ)_/¯

Reviewed By: kedromelon

Differential Revision: D16854823

fbshipit-source-id: db211dbd7391f57716775b6f32b6777626771fc1
  • Loading branch information
mrkev authored and facebook-github-bot committed Aug 28, 2019
1 parent aed35d2 commit 20a619c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/model/encoding/decodeInlineStyleRanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
* @flow strict-local
* @emails oncall+draft_js
*/

'use strict';

import type {DraftInlineStyle} from 'DraftInlineStyle';
import type {InlineStyleRange} from 'InlineStyleRange';

const UnicodeUtils = require('UnicodeUtils');

const {OrderedSet} = require('immutable');

const {substr} = UnicodeUtils;

import type {DraftInlineStyle} from 'DraftInlineStyle';

const EMPTY_SET = OrderedSet();

/**
* Convert to native JavaScript string lengths to determine ranges.
*/
function decodeInlineStyleRanges(
text: string,
ranges?: Array<Object>,
ranges?: Array<InlineStyleRange>,
): Array<DraftInlineStyle> {
const styles = Array(text.length).fill(EMPTY_SET);
if (ranges) {
ranges.forEach((/*object*/ range) => {
ranges.forEach(range => {
let cursor = substr(text, 0, range.offset).length;
const end = cursor + substr(text, range.offset, range.length).length;
while (cursor < end) {
Expand Down

0 comments on commit 20a619c

Please sign in to comment.