Skip to content

Commit

Permalink
Merge branch 'release/1.0.17' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
drewsonne committed Aug 13, 2020
2 parents 9ceecd7 + 7069a47 commit 3aa35e3
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 29 deletions.
20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"name": "@drewsonne/maya-dates",
"version": "1.0.16",
"version": "1.0.17",
"description": "Node.js package to represent dates in the Maya Calendar",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "dist/index.d.ts",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"repository": {
"type": "git",
"url": "git+ssh://[email protected]/drewsonne/maya-dates.git"
},
"publishConfig": {
"access": "public"
},
"keywords": [
"digital-humanities",
"maya",
Expand All @@ -27,22 +29,22 @@
"nyc": "^15.0.0",
"regenerator-runtime": "^0.13.3",
"ts-node": "^8.10.2",
"typedoc": "^0.16.11",
"typescript": "^3.9.7"
"typedoc": "^0.16.11"
},
"dependencies": {
"moonbeams": "^2.0.3"
"moonbeams": "^2.0.3",
"typescript": "^3.9.7"
},
"scripts": {
"test": "mocha -r ts-node/register 'src/**/*.spec.ts'",
"prepublish": "npm run build",
"build": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
"build": "rm -rf lib && tsc -p tsconfig.json",
"build:check": "tsc --noEmit -p tsconfig.json",
"build:clean": " ./scripts/clean-build.sh",
"build:docs": "typedoc --out docs src/"
},
"files": [
"lib/"
"./lib/"
],
"bugs": {
"url": "https://github.com/drewsonne/maya-dates/issues"
Expand Down
12 changes: 12 additions & 0 deletions src/__tests__/lc/long-count.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {expect} from 'chai'
import LongCount from "../../lc/long-count";
import {Wildcard} from "../../wildcard";
import {LordOfTheNight, lords} from "../../lc/night/lord-of-night";
import exp = require("constants");

describe('parse long-count fullDate', () => {
const dates = [
Expand Down Expand Up @@ -159,6 +160,10 @@ it('equality', () => {
const lc3 = new LongCount(2, 2, 2, 2, 2);
const lc4 = new LongCount(3, 3, 3, 3, 0);
const lc5 = new LongCount(3, 3, 3, 3);
const lc6 = new LongCount(new Wildcard(), new Wildcard(), 1, 1, 1)
const lc7 = new LongCount(new Wildcard(), new Wildcard(), 1, 1, 1)
const lc8 = new LongCount(10, 10, 10, 2, new Wildcard())
const lc9 = new LongCount(10, 10, 10, 2, new Wildcard())

expect(lc1.equal(lc1)).to.be.true;
expect(lc1.exactlyEqual(lc1)).to.be.true;
Expand All @@ -169,6 +174,13 @@ it('equality', () => {

expect(lc4.equal(lc5)).to.be.true;
expect(lc4.exactlyEqual(lc5)).to.be.false;

expect(lc6.equal(lc7)).to.be.true
expect(lc6.exactlyEqual(lc7)).to.be.true

expect(lc8.equal(lc9)).to.be.true
expect(lc9.exactlyEqual(lc9)).to.be.true

});

it('wildcard position failure', () => {
Expand Down
11 changes: 8 additions & 3 deletions src/lc/distance-number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ export default class DistanceNumber {

const signEqual = this.sign === other.sign;
const lengthEqual = thisMinParts.length === otherMinParts.length;
const partsEqual = thisMinParts.every((e, i) => e === otherMinParts[i]);
const partsEqual: boolean[] = thisMinParts.map((e, i) => {
return isWildcard(e) ? isWildcard(otherMinParts[i]) : e === otherMinParts[i]
});
const everyPartEqual = partsEqual.every((p) => p)

return signEqual && lengthEqual && partsEqual;
return signEqual && lengthEqual && everyPartEqual;
}

/**
Expand All @@ -98,7 +101,9 @@ export default class DistanceNumber {
exactlyEqual(other: DistanceNumber): boolean {
const signsEqual = (this.sign === other.sign);
const lengthEqual = (this.parts.length === other.parts.length);
const partsEqual = this.parts.every((e, i) => e === other.parts[i]);
const partsEqual = this.parts.every((e, i) => {
return isWildcard(e) ? isWildcard(other.parts[i]) : e === other.parts[i]
});
return signsEqual && lengthEqual && partsEqual;
}

Expand Down
7 changes: 0 additions & 7 deletions tsconfig-cjs.json

This file was deleted.

16 changes: 6 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
{
"compilerOptions": {
"target": "ES2015",
"module": "ES2020",
"moduleResolution": "Node",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"resolveJsonModule": true,
"forceConsistentCasingInFileNames": true,
"lib": [
"es6",
"ES2016.Array.Include",
"es2015",
"es2016",
"es2019"
],
"types": ["node"],
"declaration": true,
"outDir": "./lib/esm",
"rootDir": "src",
"outDir": "./lib",
"rootDir": "./src",
"strict": true,
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"inlineSources": true,
"declarationMap": true
"sourceMap": true
},
"exclude": [
"lib",
Expand Down

0 comments on commit 3aa35e3

Please sign in to comment.