Skip to content

Commit ead669a

Browse files
Remove unused ReactCommon/TurboModuleUtils functions #deepCopyJSIObject and #deepCopyJSIArray (#52443)
Summary: Pull Request resolved: #52443 Changelog: [General][Breaking] Remove unused ReactCommon/TurboModuleUtils functions #deepCopyJSIObject and #deepCopyJSIArray Those are not used anymore Reviewed By: cortinico Differential Revision: D77771186 fbshipit-source-id: e1f5e34238567241b4204d58ff85fd9067e321df
1 parent 625f69f commit ead669a

File tree

2 files changed

+3
-60
lines changed

2 files changed

+3
-60
lines changed

packages/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.cpp

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -9,59 +9,6 @@
99

1010
namespace facebook::react {
1111

12-
static jsi::Value deepCopyJSIValue(jsi::Runtime& rt, const jsi::Value& value) {
13-
if (value.isNull()) {
14-
return jsi::Value::null();
15-
}
16-
17-
if (value.isBool()) {
18-
return jsi::Value(value.getBool());
19-
}
20-
21-
if (value.isNumber()) {
22-
return jsi::Value(value.getNumber());
23-
}
24-
25-
if (value.isString()) {
26-
return value.getString(rt);
27-
}
28-
29-
if (value.isObject()) {
30-
jsi::Object o = value.getObject(rt);
31-
if (o.isArray(rt)) {
32-
return deepCopyJSIArray(rt, o.getArray(rt));
33-
}
34-
if (o.isFunction(rt)) {
35-
return o.getFunction(rt);
36-
}
37-
return deepCopyJSIObject(rt, o);
38-
}
39-
40-
return jsi::Value::undefined();
41-
}
42-
43-
jsi::Object deepCopyJSIObject(jsi::Runtime& rt, const jsi::Object& obj) {
44-
jsi::Object copy(rt);
45-
jsi::Array propertyNames = obj.getPropertyNames(rt);
46-
size_t size = propertyNames.size(rt);
47-
for (size_t i = 0; i < size; i++) {
48-
jsi::String name = propertyNames.getValueAtIndex(rt, i).getString(rt);
49-
jsi::Value value = obj.getProperty(rt, name);
50-
copy.setProperty(rt, name, deepCopyJSIValue(rt, value));
51-
}
52-
return copy;
53-
}
54-
55-
jsi::Array deepCopyJSIArray(jsi::Runtime& rt, const jsi::Array& arr) {
56-
size_t size = arr.size(rt);
57-
jsi::Array copy(rt, size);
58-
for (size_t i = 0; i < size; i++) {
59-
copy.setValueAtIndex(
60-
rt, i, deepCopyJSIValue(rt, arr.getValueAtIndex(rt, i)));
61-
}
62-
return copy;
63-
}
64-
6512
Promise::Promise(jsi::Runtime& rt, jsi::Function resolve, jsi::Function reject)
6613
: LongLivedObject(rt),
6714
resolve_(std::move(resolve)),

packages/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@
77

88
#pragma once
99

10-
#include <cassert>
11-
#include <string>
12-
1310
#include <jsi/jsi.h>
14-
#include <react/bridging/CallbackWrapper.h>
1511
#include <react/bridging/LongLivedObject.h>
12+
#include <cassert>
13+
#include <functional>
14+
#include <string>
1615

1716
namespace facebook::react {
1817

19-
jsi::Object deepCopyJSIObject(jsi::Runtime& rt, const jsi::Object& obj);
20-
jsi::Array deepCopyJSIArray(jsi::Runtime& rt, const jsi::Array& arr);
21-
2218
struct Promise : public LongLivedObject {
2319
Promise(jsi::Runtime& rt, jsi::Function resolve, jsi::Function reject);
2420

0 commit comments

Comments
 (0)