@softwear/latestcollectioncore 1.0.69 → 1.0.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/consts.d.ts CHANGED
@@ -31,4 +31,5 @@ declare const SUBSCRIPTION_LIMITS: {
31
31
  readonly maxCustomers: 10000;
32
32
  };
33
33
  };
34
- export { MAPPING_CATEGORIES, SUBSCRIPTION_LIMITS };
34
+ declare const DATA_PROVIDERS: "euretco,fashionunited,fashioncloud,linolux,barcodebot,triumph_it";
35
+ export { MAPPING_CATEGORIES, SUBSCRIPTION_LIMITS, DATA_PROVIDERS };
package/dist/consts.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SUBSCRIPTION_LIMITS = exports.MAPPING_CATEGORIES = void 0;
3
+ exports.DATA_PROVIDERS = exports.SUBSCRIPTION_LIMITS = exports.MAPPING_CATEGORIES = void 0;
4
4
  const MAPPING_CATEGORIES = [
5
5
  'BTEGroup',
6
6
  'Collection',
@@ -49,3 +49,5 @@ const SUBSCRIPTION_LIMITS = {
49
49
  },
50
50
  };
51
51
  exports.SUBSCRIPTION_LIMITS = SUBSCRIPTION_LIMITS;
52
+ const DATA_PROVIDERS = 'euretco,fashionunited,fashioncloud,linolux,barcodebot,triumph_it';
53
+ exports.DATA_PROVIDERS = DATA_PROVIDERS;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { default as buildPropertyMappingFn } from './buildPropertyMappingFn';
2
2
  export { default as deepCopy } from './deepCopy';
3
3
  export { default as ean13 } from './ean13';
4
+ export { default as isean13 } from './isean13';
4
5
  export { default as getPreferedPropertyMappings } from './getPreferedPropertyMappings';
5
6
  export { default as hashBrand } from './hashBrand';
6
7
  export { default as hasOnlyDigits } from './hasOnlyDigits';
package/dist/index.js CHANGED
@@ -17,13 +17,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.sizeToMap = exports.hasOnlyDigits = exports.hashBrand = exports.getPreferedPropertyMappings = exports.ean13 = exports.deepCopy = exports.buildPropertyMappingFn = void 0;
20
+ exports.sizeToMap = exports.hasOnlyDigits = exports.hashBrand = exports.getPreferedPropertyMappings = exports.isean13 = exports.ean13 = exports.deepCopy = exports.buildPropertyMappingFn = void 0;
21
21
  var buildPropertyMappingFn_1 = require("./buildPropertyMappingFn");
22
22
  Object.defineProperty(exports, "buildPropertyMappingFn", { enumerable: true, get: function () { return __importDefault(buildPropertyMappingFn_1).default; } });
23
23
  var deepCopy_1 = require("./deepCopy");
24
24
  Object.defineProperty(exports, "deepCopy", { enumerable: true, get: function () { return __importDefault(deepCopy_1).default; } });
25
25
  var ean13_1 = require("./ean13");
26
26
  Object.defineProperty(exports, "ean13", { enumerable: true, get: function () { return __importDefault(ean13_1).default; } });
27
+ var isean13_1 = require("./isean13");
28
+ Object.defineProperty(exports, "isean13", { enumerable: true, get: function () { return __importDefault(isean13_1).default; } });
27
29
  var getPreferedPropertyMappings_1 = require("./getPreferedPropertyMappings");
28
30
  Object.defineProperty(exports, "getPreferedPropertyMappings", { enumerable: true, get: function () { return __importDefault(getPreferedPropertyMappings_1).default; } });
29
31
  var hashBrand_1 = require("./hashBrand");
@@ -0,0 +1 @@
1
+ export default function (value: string | number): boolean;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const ean13_1 = __importDefault(require("./ean13"));
7
+ function default_1(value) {
8
+ const type = typeof value;
9
+ if (type != 'string' && type != 'number')
10
+ return false;
11
+ const stringILN = '' + value;
12
+ if (stringILN.length != 13)
13
+ return false;
14
+ const baseNumber = stringILN.substring(0, 12);
15
+ return (0, ean13_1.default)(baseNumber) + '' == stringILN;
16
+ }
17
+ exports.default = default_1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwear/latestcollectioncore",
3
- "version": "1.0.69",
3
+ "version": "1.0.71",
4
4
  "description": "Core functions for LatestCollections applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/consts.ts CHANGED
@@ -44,4 +44,5 @@ const SUBSCRIPTION_LIMITS = {
44
44
  maxCustomers: 10000,
45
45
  },
46
46
  } as const
47
- export { MAPPING_CATEGORIES, SUBSCRIPTION_LIMITS }
47
+ const DATA_PROVIDERS = 'euretco,fashionunited,fashioncloud,linolux,barcodebot,triumph_it' as const
48
+ export { MAPPING_CATEGORIES, SUBSCRIPTION_LIMITS, DATA_PROVIDERS }
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { default as buildPropertyMappingFn } from './buildPropertyMappingFn'
2
2
  export { default as deepCopy } from './deepCopy'
3
3
  export { default as ean13 } from './ean13'
4
+ export { default as isean13 } from './isean13'
4
5
  export { default as getPreferedPropertyMappings } from './getPreferedPropertyMappings'
5
6
  export { default as hashBrand } from './hashBrand'
6
7
  export { default as hasOnlyDigits } from './hasOnlyDigits'
package/src/isean13.ts ADDED
@@ -0,0 +1,12 @@
1
+ import ean13 from './ean13'
2
+
3
+ export default function (value: string | number): boolean {
4
+ const type = typeof value
5
+ if (type != 'string' && type != 'number') return false
6
+
7
+ const stringILN = '' + value
8
+ if (stringILN.length != 13) return false
9
+
10
+ const baseNumber = stringILN.substring(0, 12)
11
+ return ean13(baseNumber) + '' == stringILN
12
+ }
@@ -0,0 +1,15 @@
1
+ const { isean13 } = require('../dist/index')
2
+ const { expect } = require('chai')
3
+
4
+ describe('isean13 function', function () {
5
+ it('should fail on non EAN13 number', function () {
6
+ expect(isean13('1234567890129')).to.equal(false)
7
+ expect(isean13('123')).to.equal(false)
8
+ expect(isean13(123)).to.equal(false)
9
+ expect(isean13(new Date())).to.equal(false)
10
+ })
11
+ it('should pass on correct EAN13 numbers', function () {
12
+ expect(isean13('1234567890128')).to.equal(true)
13
+ expect(isean13('1234567890111')).to.equal(true)
14
+ })
15
+ })