Open ananzh opened 1 year ago
I've created a migration plan, but I'm not entirely certain about its accuracy. Would you mind taking a look and providing feedback?
Step 1: Analyze and catalog Lodash usage
Step 2: Research and propose native JavaScript alternatives
Step 3: Prioritize Lodash functions for replacement
Step 4: Divide the project into logical sections
Step 5: Create sub-tasks for each section and Lodash function
Step 6: Implement native JavaScript alternatives
Step 7: Update and run tests
Step 8: Review and optimize
Step 3: Prioritize Lodash functions for replacement
Rank the Lodash functions based on factors like usage frequency and potential performance gains. Create a priority list to guide the replacement process.
It is hard to give a rank. We could just move to step 4 and start working on them one by one.
* Step 4 and 5 could be combined. Just need to break down to small sub issues.
* Step 6, 7 and 8 are all implementation details.
Overall we could focus on 1) summarize usage in https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3660 2) propose solutions with pros and cons 3) break down tasks into sub issues.
@ltwmori Are you interested in taking this task?
Hello @ananzh ! Yes, I'd like to collaborate on this issue as well.
Hi, I already have an issue to work on. So, mb @nurSaadat can work on it?
@nurSaadat Let's work together?
Based on the issue at https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3660, let's summarize the key points. Here are a couple of questions that summarize the issue as well as migration plan:
Do we really need to eliminate Lodash entirely from our project? Some functions cannot be replaced with native JS, so we do need Lodash in some cases, such as cloneDeep. However, we should import only the necessary functions instead of using the entire library. For example, we can import cloneDeep from "lodash/cloneDeep" and install npm i lodash.clonedeep --save, rather than installing the whole package.
What is the difference between Lodash and Underscore.js? Lodash API is a superset of Underscore.js. Lodash tends to prioritize performance and provides many optimized methods, while Underscore.js focuses more on simplicity and ease of use. We need to decide whether performance or ease of use is more important. If performance is a top concern, we may want to consider using Lodash. However, if simplicity and ease of use are more important, Underscore.js may be the better choice.
Are we replacing Lodash with ES6 or ES5? We should use both since we have already encountered legacy codebases dependent on ES5. I found a useful plugin (https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore) that can help identify places in the codebase where we don't need Lodash or Underscore. We can install this plugin to reduce mundane work, but we should also consider creating our own plugin.
To replace Lodash functions with native JavaScript methods, we can follow these steps:
Step 1: If we use the Eslint plugin (https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore), we can install the plugin from npm, replace all files by Eslint suggestion, and look for cases where we are not replacing our functionality. Step 2: Consider whether to use ES6 or ES5. Replace the most commonly used methods first, then replace functions by type (e.g., replace all Arrays, then Collections, etc.). Rewrite testing files and test. Step 3: Replace with importing only the necessary methods, not the whole package. Remove all unnecessary imports without usages. If we are not using the Eslint plugin, replace all Lodash functions replaceable by category (Array, Collection, Lang, Functions, etc.) according to the table. Replace the most popular category first. For irreplaceable methods, brush up the usage by installing only the particular method used.
References https://nicozerpa.com/lodash-underscore-necessary-or-obsolete/ https://www.geeksforgeeks.org/difference-between-lodash-and-underscore/
I need to fill up this table entirely as pre-step for replacement, I am free for helping me:
method
Method type
Any issues with this method
Can be replaced with native JS
Count of occurrence
Additional notes
ES6 or ES 5?
Occurrences in files
_.cloneDeepWith( value, customizer )
Lang
Â
No
4
Â
Â
OpenSearch-Dashboards/test/functional/services/common/browser.tsDeep_clone_with_buffers.jspackages/osd-test/src/functional_test_runner/lib/config/config.tspackages/osd-pm/src/test_helpers/absolute_path_snapshot_serializer.ts
_.keyBy( collection, iteratee )
Collection
Â
yes
3
Â
Â
OpenSearch-Dashboards/test/functional/page_objects/management/saved_objects_page.tsOpenSearch-Dashboards/test/functional/apps/management/_import_objects.js
_.remove(array, function)
Array
https://dustinpfister.github.io/2017/09/19/lodash_remove/
Yes
Â
We need to chose one: I will be going over vanilla js solutions for removing elements from an array.native array filter, array slice, Array.splice to remove a element
Â
OpenSearch-Dashboards/test/functional/apps/visualize/_chart_types.ts
_.get(object, path, [defaultValue])
Object
No
Yes
>40
Â
Â
OpenSearch-Dashboards/test/common/services/deployment.tsOpenSearch-Dashboards/test/api_integration/apis/dql_telemetry/dql_telemetry.jsOpenSearch-Dashboards/src/plugins/visualize/public/application/utils/migrate_app_state.tsOpenSearch-Dashboards/src/plugins/visualizations/server/saved_objects/visualization_migrations.tsOpenSearch-Dashboards/src/plugins/visualizations/public/persisted_state/persisted_state.tsOpenSearch-Dashboards/src/plugins/visualizations/public/legacy/vis_update_state.jsOpenSearch-Dashboards/src/plugins/visualizations/public/legacy/build_pipeline.tsOpenSearch-Dashboards/src/plugins/visualizations/public/expressions/visualization_function.tsOpenSearch-Dashboards/src/plugins/visualizations/public/embeddable/visualize_embeddable.tsOpenSearch-Dashboards/src/plugins/visualizations/public/components/visualization.tsx
.uniq(array).map( collection, iteratee )
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/test/api_integration/apis/telemetry/telemetry_local.js
_.set(object, path, value)Â -> @elastic/safer-lodash-set
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/test/api_integration/apis/saved_objects/migrations.tsOpenSearch-Dashboards/src/plugins/visualizations/public/persisted_state/persisted_state.tsOpenSearch-Dashboards/src/plugins/visualizations/public/legacy/vis_update_state.js
_.omit( object, paths )
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/test/api_integration/apis/saved_objects/migrations.tsOpenSearch-Dashboards/test/api_integration/apis/saved_objects/bulk_update.jsOpenSearch-Dashboards/src/plugins/visualize/public/application/utils/migrate_app_state.tsOpenSearch-Dashboards/src/plugins/visualizations/server/saved_objects/visualization_migrations.ts
_.sortBy(collection, iteratees)
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/test/api_integration/apis/saved_objects/bulk_update.jsOpenSearch-Dashboards/packages/osd-ui-framework/src/services/sort/sortable_properties.js
_.isNull(value)
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/tasks/licenses_csv_report.jsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.jsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.js
_.isUndefined(value)
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/tasks/licenses_csv_report.jsOpenSearch-Dashboards/src/plugins/visualizations/public/expressions/vis.ts
_.assign( dest_object, src_obj )
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/test_utils/get_url.js
_.pickBy( object, predicate )
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/test_utils/get_url.js
_.pick( object, paths )
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/test_utils/get_url.js
_.template( string, options )
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/setup_node_env/harden/lodash_template.js
_.cloneDeep( value )
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualize/public/application/utils/use/use_visualize_app_state.tsxOpenSearch-Dashboards/src/plugins/visualize/public/application/utils/get_visualization_instance.tsOpenSearch-Dashboards/src/plugins/visualizations/server/saved_objects/visualization_migrations.tsOpenSearch-Dashboards/src/plugins/visualizations/public/legacy/vis_update_state.test.jsOpenSearch-Dashboards/src/plugins/visualizations/public/vis_types/react_vis_type.test.tsOpenSearch-Dashboards/src/plugins/visualizations/public/persisted_state/persisted_state.tsOpenSearch-Dashboards/src/plugins/visualizations/public/legacy/vis_update_state.jsOpenSearch-Dashboards/src/plugins/visualizations/public/expressions/vis.tsOpenSearch-Dashboards/src/plugins/visualizations/public/embeddable/visualize_embeddable.tsOpenSearch-Dashboards/src/plugins/visualizations/public/vis.ts
_.isEqual( value1, value2)
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualize/public/application/utils/use/use_visualize_app_state.tsxOpenSearch-Dashboards/src/plugins/visualize/public/application/utils/use/use_editor_updates.tsOpenSearch-Dashboards/src/plugins/visualizations/public/persisted_state/persisted_state.tsOpenSearch-Dashboards/src/plugins/visualizations/public/legacy/vis_update_state.test.jsOpenSearch-Dashboards/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts
_.has(object, path)
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualize/public/application/utils/migrate_legacy_query.tsOpenSearch-Dashboards/src/plugins/visualizations/server/saved_objects/visualization_migrations.ts
_.isFunction( value )
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualize/public/application/utils/create_visualize_app_state.tsOpenSearch-Dashboards/src/plugins/visualizations/public/expressions/vis.tsOpenSearch-Dashboards/src/plugins/visualizations/public/vis.tsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.test.jsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.test.jsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.test.js
_.omitBy( object, predicate )
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualize/public/application/utils/create_visualize_app_state.ts
_.union(*arrays)
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualize/public/application/utils/create_visualize_app_state.ts
.countBy(collection, [iteratee=.identity])
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualizations/server/usage_collector/get_usage_collector.ts
_.groupBy( collection, iteratee )
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualizations/server/usage_collector/get_usage_collector.ts
_.mapValues( object, iteratee )
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualizations/server/usage_collector/get_usage_collector.ts
_.max
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualizations/server/usage_collector/get_usage_collector.ts
_.min
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualizations/server/usage_collector/get_usage_collector.tsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.js
_.value
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualizations/server/usage_collector/get_usage_collector.ts
_.flow( funcs )
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualizations/server/saved_objects/visualization_migrations.ts
_.orderBy(collection, iteratees, orders)
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualizations/public/wizard/type_selection/type_selection.tsx
_.defaultsDeep(object, [sources])
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualizations/public/vis_types/base_vis_type.tsOpenSearch-Dashboards/src/plugins/visualizations/public/expressions/vis.tsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.test.js
_.isPlainObject
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualizations/public/persisted_state/persisted_state.ts
_.isString
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualizations/public/persisted_state/persisted_state.ts
_.merge
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualizations/public/persisted_state/persisted_state.ts
_.mergeWith
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualizations/public/persisted_state/persisted_state.ts
_.defaults
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/visualizations/public/vis.tsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.jsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.jsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.jsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.jsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_point_series.js
_.noop
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.test.jsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.test.jsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.test.jsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.test.js
_.find
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.jsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.test.jsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_point_series.jsOpenSearch-Dashboards/src/cli/cli.js
_.isNumber
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.test.jsOpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.test.js
_.forOwn
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.test.js
_.last
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/meter.js
_.isObject
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/vis_types.test.jsOpenSearch-Dashboards/packages/osd-ui-framework/src/components/table/listing_table/listing_table_row.jsOpenSearch-Dashboards/packages/osd-ui-framework/src/components/table/listing_table/listing_table.js
_.uniqueId
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series.js
_.identity
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series.js
_.each
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series.js
_.bind
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/visualizations/_chart.js
_.forEach
Â
Â
Â
Â
Â
Â
Â
_.flattenDeep
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/axis/y_axis.test.js
_.isDate
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/axis/x_axis.test.js
_.times
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_scale.js
_.reduce
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_scale.js
_.isNaN
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_scale.js
_.filter
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/handler.js
_.memoize
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/handler.js
_.first
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/dispatch.test.js
_.pull
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/dispatch.js
_.rest
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/dispatch.js
_.size
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/dispatch.jsOpenSearch-Dashboards/src/cli/help.js
_.reduce
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/dispatch.js
_.uniqBy
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/data.js
_.clone
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/data.js
_.toArray
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/data.js
_.escape
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/lib/chart_title.js
_.uniq
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.ts
_.partial
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_injection.test.js
_.keys
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_injection.test.js
_.findIndex
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_fill_data_array.js
_.constant
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/components/tooltip/tooltip.js
_.once
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/components/tooltip/tooltip.js
_.random
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.test.js
_.drop
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.test.js
_.mergeWith
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.js
_.forEachRight
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_hierarchical_tooltip_formatter.js
_.repeat
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_hierarchical_tooltip_formatter.js
_.every
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/components/legend/legend.tsx
_.findLast
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_default_editor/public/components/sidebar/data_tab.tsx
_.compact
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/components/legend/legend.tsx
_.chain
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/vislib/components/labels/labels.test.js
_.upperFirst
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vislib/public/components/options/metrics_axes/utils.ts
_.flatten
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vega/public/lib/extract_index_pattern.ts
_.isPlainObject
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_vega/public/data_model/vega_parser.ts
_.sum
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/_series_agg.js
_.zip
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/table/_series_agg.js
_.startsWith
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/time_shift.js
_.isEmpty
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/annotations/buckets.js
_.includes
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_sibling_agg_value.js
._gt, .gte, .lt
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeseries/public/application/components/vis_types/top_n/vis.js
_.snakeCase
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeseries/public/application/components/lib/convert_series_to_vars.js
_.debounce
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeseries/public/application/components/vis_editor.js
_.isBoolean
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeseries/public/application/components/add_delete_buttons.tsx
_.mapValues
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeline/server/series_functions/opensearch/lib/agg_response_to_series_list.js
_.fill
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeline/server/series_functions/aggregate/index.js
_.fromPairs
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeline/server/lib/load_functions.js
_.extend
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeline/server/lib/functions_md.js
_.without
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeline/server/lib/functions_md.js
_.difference
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_timeline/server/handlers/lib/validate_arg.js
_.throttle
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/vis_type_tagcloud/public/components/tag_cloud_chart.tsx
_.findLastIndex
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/timeline/public/directives/cells/collection.ts
_.words
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/timeline/public/directives/saved_object_finder.js
_.capitalize
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/timeline/public/directives/saved_object_finder.js
_.assignIn
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/timeline/public/app.js
_.round
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/tile_map/public/tile_map_visualization.js
_.trim
Â
Â
Â
Â
Â
Â
Â
_.trimStart
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/data/common/field_formats/field_format.test.ts
_.trimEnd
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/data/common/field_formats/field_format.test.ts
_.take
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.tsx
_.getField
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.tsx
_.mapKeys
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/saved_objects_management/public/lib/case_conversion.ts
_.padStart
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/opensearch_ui_shared/public/components/cron_editor/cron_editor.js
_.pad
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/legacy/server/logging/log_format_string.js
_.transform
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/opensearch_dashboards_utils/common/url/encode_uri_query.ts
_.escapeRegExp
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/opensearch_dashboards_utils/common/field_wildcard.ts
_.parseInt
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/opensearch_dashboards_legacy/public/paginate/paginate.js
_.intersection
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsxOpenSearch-Dashboards/src/cli/cli.js
_.zipObject
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/expressions/common/expression_types/specs/datatable.ts
_.shuffle
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_capabilities.test.js
_.hasIn
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/data/public/search/expressions/opensearchaggs.ts
_.trimEnd
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/data/public/search/search_interceptor.ts
_.partition
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/data/public/query/timefilter/lib/extract_time_filter.ts
.take, .remove
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/data/public/query/persisted_log/persisted_log.ts
_.reduceRight
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/data/public/query/filter_manager/lib/map_filter.ts
_.findKey
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/data/common/search/tabify/buckets.ts
_.setWith ->@elastic/safer-lodash-set
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/data/common/search/search_source/search_source.ts
_.startCase
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/data/common/search/aggs/metrics/lib/make_nested_label.ts
_.dropRight
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/data/common/search/aggs/metrics/top_hit.test.ts
_.reject
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts
_.truncate
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/data/common/field_formats/converters/truncate.ts
_.head
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/console/server/lib/opensearch_proxy_config.ts
_.some
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/console/public/lib/autocomplete/components/list_component.js
_.sampleSize
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/plugins/charts/public/services/colors/mapped_colors.ts
_.toPath
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/legacy/utils/unset.ts
_.range
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/fixtures/agg_resp/geohash_grid.js
_.delay
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/cli_plugin/install/rename.js
_.padEnd
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/cli/help.js
_.wrap
Â
Â
Â
Â
Â
Â
OpenSearch-Dashboards/src/cli/command.js
@Aigerim-ai I really like the idea with the package that helps us to replace all the functions.
I also would like to propose dividing migration into logical parts by plugin. We have several affected plugins as well as files outside of them. The latter can be done later in a more granular way.
Dear @nurSaadat, I have already got the approval from @ashwin-pc and working on the replacement, please look at the issue I have created
@ashwin-pc could you please assign this issue for me?
Replacing the functions can be done by creating separate issues for each subtask.
Lodash methods are currently can be found in 813 files, here is the list
Question: Is it safe to ignore .eslint.rc.js files?
My approach would be to change the methods package by package, plugin by plugin. To be specific that would include 93 different subtasks listed in this file
I'd like to use this conversion table created by research and discussions with ChatGPT.
I think it would be neat to create separate issues for each subtask for discussion and easier navigation.
References to resources used: https://www.sitepoint.com/lodash-features-replace-es6/ https://blog.bitsrc.io/you-dont-need-lodash-or-how-i-started-loving-javascript-functions-3f45791fa6cd
Based on usage research issue (https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3660) regarding the methods, the goal of this task: