首页 > 解决方案 > 什么是 Fuse JavaScript search() 函数在数组上的 Big-O,由 Order 对象组成。请参阅下面的订单对象

问题描述

我试图弄清楚使用 fuse.js 的 Big-O 分析,它使用模糊搜索来查找数据。我计划允许使用搜索订单;order_id、customerName 或 orderDate。

export const orderData = [
    {
        order_id: '20180101203000',
        orderDate: '2018-01-01:20:30:00',
        orderStatus: 'Pending',
        customerId: 1,
        customerName: 'Mbami Luka',
        customerCity: 'New York',
        customerState: 'New York',
        customerCountry: 'USA',
        customerPhone: '+1-212-555-1212',
        org_id: 'DANDL3ION',
        org_name: 'Dandelion',
        orderTotal: '$1,000.00',
        orderItems: [
            {
                productId: 1,
                productName: 'Pasta',
                productSKU: 'SKU-001',
                productPrice: '$5.00',
                productQuantity: 1,
                productTotal: '$5.00',
                prodictImage: 'https://www.pexels.com/photo/food-plate-dinner-lunch-5807019/'
            },
            {
                productId: 2,
                productName: 'Kebab',
                productSKU: 'SKU-002',
                productPrice: '$10.00',
                productQuantity: 1,
                productTotal: '$10.00',
                prodictImage: 'https://www.pexels.com/photo/food-dinner-lunch-meal-5191852/'
            },
        ],
    },

    {
        order_id: '20180101203003',
        orderDate: '2018-01-01:20:30:03',
        orderStatus: 'Pending',
        customerId: 1,
        customerName: 'Bradley Isaacs',
        customerCity: 'New York',
        customerState: 'New York',
        customerCountry: 'USA',
        customerPhone: '+1-212-555-1212',
        org_id: 'MSUDENVER',
        org_name: 'Dandelion',
        orderTotal: '$1,000.00',
        orderItems: [
            {
                id: 3,
                productId: 3,
                productName: 'Pizza',
                productSKU: 'SKU-003',
                productPrice: '$15.00',
                productQuantity: 1,
                productTotal: '$5.00',
                prodictImage: 'https://www.pexels.com/photo/pizza-with-red-pepper-and-cheese-1049620/',
            },
            {
                id: 4,
                productId: 4,
                productName: 'Apple pie',
                productSKU: 'SKU-004',
                productPrice: '$10.00',
                productQuantity: 1,
                productTotal: '$10.00',
                prodictImage: 'https://www.pexels.com/photo/deliciously-baked-apple-pie-7790871/',
            },
        ],
    },

标签: javascriptsearchfuse.js

解决方案


推荐阅读