How to use the shopify-buy/metal/uniq function in shopify-buy

To help you get started, we’ve selected a few shopify-buy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Shopify / js-buy-sdk / tests / unit / metal / set-guid-for.js View on Github external
test('it generates unique ids', function (assert) {
  assert.expect(1);
  let i;
  const items = [];

  for (i = 0; i < 1000; i++) {
    items.push({});
  }

  const ids = items.map(item => {
    return setGuidFor(item);
  });

  const uniqueIds = uniq(ids);

  assert.deepEqual(uniqueIds, ids, 'all ids should be unique');
});
github Shopify / js-buy-sdk / tests / unit / metal / set-guid-for.js View on Github external
true,
    true,
    true,
    false,
    false,
    {},
    dupedObject,
    dupedObject
  ];

  const ids = items.map(item => {
    return setGuidFor(item);
  });

  const uniqueIds = uniq(ids);
  const uniqueItems = uniq(items);

  assert.equal(uniqueIds.length, uniqueItems.length, 'the number of unique ids matches the number of unique items');
});
github Shopify / js-buy-sdk / tests / unit / metal / set-guid-for.js View on Github external
'duplicate words',
    true,
    true,
    true,
    false,
    false,
    {},
    dupedObject,
    dupedObject
  ];

  const ids = items.map(item => {
    return setGuidFor(item);
  });

  const uniqueIds = uniq(ids);
  const uniqueItems = uniq(items);

  assert.equal(uniqueIds.length, uniqueItems.length, 'the number of unique ids matches the number of unique items');
});

shopify-buy

The JS Buy SDK is a lightweight library that allows you to build ecommerce into any website. It is based on Shopify's API and provides the ability to retrieve products and collections from your shop, add products to a cart, and checkout.

MIT
Latest version published 8 months ago

Package Health Score

83 / 100
Full package analysis