Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

non-enumerable object properties are lost after passing an object to workerize.

Đang mở
#34 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
web-dev

Hướng nghiên cứu

Bắt đầu với ví dụ workerize-loader và tái hiện khác biệt đã được báo cáo giữa các đối tượng Firebase và kết quả đã lọc. Kiểm tra ranh giới của lệnh gọi worker và README để xác định liệu việc giữ lại các thuộc tính không thể liệt kê có phải là chủ đích hay không. Được xem là hoàn tất nếu các thuộc tính id được giữ lại xuyên suốt lệnh gọi hoặc hành vi quan sát được được ghi lại một cách rõ ràng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Here's a real life example:

// The main thread
import Worker from 'workerize-loader!./workers';
import getCompaniesFromFirebase from './getCompaniesFromFirebase';

const worker = Worker();

const {
  filterCompaniesByTypes
  // Other modules
} = worker;

(async () => {
  const companies = await getCompaniesFromFirebase();
  // typeof companies[0].id === "string" // true

  const companiesFiltered = await filterCompaniesByTypes(companies, ['company-type-1', 'company-type-2']);
  // typeof companiesFiltered[0].id === "string" // false
  // typeof companiesFiltered[0].id === "undefined" // true
})();
// The worker
import intersection from 'lodash/intersection';

export const filterCompaniesByTypes = (companies, typesToFilerBy) => {
  return companies.filter(({ types, id }) => {
    // typeof id === 'undefined' // true
    return intersection(types, typesToFilerBy).length > 0;
  });
};

In the given example the getCompaniesFromFirebase() function returns an array of objects. Each object has some properties, inluding the id property that is non-enumerable.

After executing the filterCompaniesByTypes() function (which is a web worker function) I receive a filtered array. All id properties are gone.


if it's the desired behaviour (or an unpleasant, but expected, side-effect) not a bug, then it would be good to mention it in the readme.

Ngôn ngữ chính
JavaScript
Star
4.4k
Fork
87
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của developit/workerize

Tất cả issue của developit/workerize

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.