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

Commit

Permalink
Fix build by adding missing modules
Browse files Browse the repository at this point in the history
Summary:
Recent diffs added these two dependencies, which live outside the draft-js folder and so they don't get copied over to the github repo.

Options:

- **Copy them as our own versions inside the draft.js folder.** This means they have to be named something unique, and since they are utility functions it'd be kind of odd.

- **Copy them to the folder of files that get shipped to the repo.** Since they live outside the realm of Haste, they can have the same name.

I went for the latter.

Reviewed By: creedarky

Differential Revision: D21148037

fbshipit-source-id: ba08de495912e23474df0d7649b6e64dbae45940
  • Loading branch information
mrkev authored and facebook-github-bot committed Apr 21, 2020
1 parent dfacb1b commit fbe3417
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/util/getOwnObjectValues.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @flow strict
* @typechecks
* @format
*/

/**
* Retrieve an object's own values as an array. If you want the values in the
* protoype chain, too, use getObjectValuesIncludingPrototype.
*
* If you are looking for a function that creates an Array instance based
* on an "Array-like" object, use createArrayFrom instead.
*
* @param {object} obj An object.
* @return {array} The object's values.
*/
function getOwnObjectValues<TValue>(obj: {
+[key: string]: TValue,
...,
}): Array<TValue> {
return Object.keys(obj).map(key => obj[key]);
}

module.exports = getOwnObjectValues;
23 changes: 23 additions & 0 deletions src/util/uuid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @typechecks
* @flow strict
* @format
*/

/*eslint-disable no-bitwise */

/**
* Based on the rfc4122-compliant solution posted at
* http://stackoverflow.com/questions/105034
*/
function uuid(): string {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
const r = (Math.random() * 16) | 0;
const v = c == 'x' ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
}

module.exports = uuid;

0 comments on commit fbe3417

Please sign in to comment.