@softwear/latestcollectioncore 1.0.2 → 1.0.4

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.
@@ -0,0 +1 @@
1
+ export default function (baseNumberAsString: string): number;
package/dist/ean13.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
- module.exports = function (baseNumberAsString) {
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function default_1(baseNumberAsString) {
3
4
  const calculateCheckDigit = function (baseNumberAsString) {
4
5
  if (!Number(baseNumberAsString) || baseNumberAsString.length !== 12) {
5
6
  throw Error(`Not an EAN 13 base number. Must have a number with 12 digits, got ${baseNumberAsString}`);
@@ -14,4 +15,5 @@ module.exports = function (baseNumberAsString) {
14
15
  };
15
16
  const checkDigit = calculateCheckDigit(baseNumberAsString);
16
17
  return Number(baseNumberAsString) * 10 + checkDigit;
17
- };
18
+ }
19
+ exports.default = default_1;
@@ -0,0 +1 @@
1
+ export default function (brand?: string): string;
package/dist/hashBrand.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
- module.exports = function (brand = "") {
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function default_1(brand = "") {
3
4
  if (typeof brand != "string")
4
5
  return "";
5
6
  const charactersToRemove = "~<>!@#$%^&*():'\"? ";
@@ -11,4 +12,5 @@ module.exports = function (brand = "") {
11
12
  result = result + c;
12
13
  }
13
14
  return result.toLocaleLowerCase();
14
- };
15
+ }
16
+ exports.default = default_1;
@@ -0,0 +1,2 @@
1
+ export { default as ean13 } from "./ean13";
2
+ export { default as hashBrand } from "./hashBrand";
package/dist/index.js CHANGED
@@ -1,5 +1,10 @@
1
1
  "use strict";
2
- module.exports = {
3
- ean13: require("./ean13"),
4
- hashBrand: require("./hashBrand"),
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
4
  };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.hashBrand = exports.ean13 = void 0;
7
+ var ean13_1 = require("./ean13");
8
+ Object.defineProperty(exports, "ean13", { enumerable: true, get: function () { return __importDefault(ean13_1).default; } });
9
+ var hashBrand_1 = require("./hashBrand");
10
+ Object.defineProperty(exports, "hashBrand", { enumerable: true, get: function () { return __importDefault(hashBrand_1).default; } });
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@softwear/latestcollectioncore",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Core functions for LatestCollections applications",
5
5
  "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
6
7
  "scripts": {
7
8
  "build": "tsc -p tsconfig.json",
8
9
  "test": "mocha"
package/src/ean13.ts CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = function (baseNumberAsString): number {
1
+ export default function (baseNumberAsString: string): number {
2
2
  const calculateCheckDigit = function (baseNumberAsString: string): number {
3
3
  if (!Number(baseNumberAsString) || baseNumberAsString.length !== 12) {
4
4
  throw Error(`Not an EAN 13 base number. Must have a number with 12 digits, got ${baseNumberAsString}`)
package/src/hashBrand.ts CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = function (brand = ""): string {
1
+ export default function (brand = ""): string {
2
2
  if (typeof brand != "string") return ""
3
3
  const charactersToRemove = "~<>!@#$%^&*():'\"? "
4
4
  const l = brand.length
package/src/index.ts CHANGED
@@ -1,4 +1,2 @@
1
- module.exports = {
2
- ean13: require("./ean13"),
3
- hashBrand: require("./hashBrand"),
4
- }
1
+ export { default as ean13 } from "./ean13"
2
+ export { default as hashBrand } from "./hashBrand"
@@ -1,5 +1,6 @@
1
- const { ean13 } = require("../dist/index.js")
1
+ const { ean13 } = require("../dist/index")
2
2
  const { assert } = require("chai")
3
+
3
4
  const should = require("chai").should()
4
5
 
5
6
  describe("ean13 function", function () {
@@ -1,4 +1,4 @@
1
- const { hashBrand } = require("../dist/index.js")
1
+ const { hashBrand } = require("../dist/index")
2
2
  const { assert } = require("chai")
3
3
 
4
4
  describe("hashBrand function", function () {
package/tsconfig.json CHANGED
@@ -4,12 +4,12 @@
4
4
  /* Basic Options */
5
5
  // "incremental": true, /* Enable incremental compilation */
6
6
  "target": "es2021" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
7
- "module": "es2020" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
7
+ "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
8
8
  // "lib": [], /* Specify library files to be included in the compilation. */
9
9
  // "allowJs": true, /* Allow javascript files to be compiled. */
10
10
  // "checkJs": true, /* Report errors in .js files. */
11
11
  // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
12
- // "declaration": true /* Generates corresponding '.d.ts' file. */,
12
+ "declaration": true /* Generates corresponding '.d.ts' file. */,
13
13
  // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
14
14
  // "sourceMap": true, /* Generates corresponding '.map' file. */
15
15
  // "outFile": "./", /* Concatenate and emit output to single file. */