chart2txt 0.3.0 → 0.3.1

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.
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.chart2txt=n():e.chart2txt=n()}(this,(()=>(()=>{"use strict";var e={921:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DEFAULT_SETTINGS=n.DEFAULT_ASPECTS=n.ZODIAC_SIGNS=void 0,n.ZODIAC_SIGNS=["Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces"],n.DEFAULT_ASPECTS=[{name:"conjunction",angle:0,orb:5},{name:"opposition",angle:180,orb:5},{name:"trine",angle:120,orb:5},{name:"square",angle:90,orb:5},{name:"sextile",angle:60,orb:3}],n.DEFAULT_SETTINGS={includeSignDegree:!0,omitSigns:!1,houseSystem:"equal",includeHouseDegree:!1,omitHouses:!1,includeAscendant:!0,omitPoints:!1,aspectDefinitions:n.DEFAULT_ASPECTS,omitAspects:!1}}},n={};function t(o){var s=n[o];if(void 0!==s)return s.exports;var i=n[o]={exports:{}};return e[o](i,i.exports,t),i.exports}var o={};return(()=>{var e=o;const n=t(921);function s(e,t,o=[],s=n.DEFAULT_SETTINGS.includeSignDegree){const i=[...t?[{name:"Ascendant",degree:t}]:[],...e,...o].map((e=>{const t=function(e){const t=Math.floor(e/30)%12;return n.ZODIAC_SIGNS[t]}(e.degree);if(s){const n=Math.floor(e.degree%30);return`${e.name} is at ${n}° ${t}`}return`${e.name} is in ${t}`})).join(". ");return i?`${i}.`:""}function i(e,t,o,s=[],i=n.DEFAULT_SETTINGS.includeHouseDegree){const r=[...o,...s].map((n=>{const o=function(e,n,t){switch(e){case"equal":{const e=(n-t+360)%360;return{house:Math.floor(e/30)+1,degree:e%30}}case"whole_sign":{const e=(n-Math.floor(t/30)%12*30+360)%360;return{house:Math.floor(e/30)+1,degree:e%30}}}}(e,n.degree,t);return i?`${n.name} is at ${o.degree}° in house ${o.house}`:`${n.name} is in house ${o.house}`})).join(". ");return r?`${r}.`:""}function r(e,t={}){const o=Object.assign({},n.DEFAULT_SETTINGS,t);let r="Astrology Chart";const a=(c=e.location,u=e.timestamp,[c?`location: ${c}`:"",u?`at: ${u.toISOString()}`:""].filter((e=>""!==e)).join(", "));var c,u;if(a&&(r+=` (${a})`),r+=":\n\n",o.omitSigns||(r+=s(e.planets,o.includeAscendant&&e.ascendant?e.ascendant:void 0,o.omitPoints?[]:e.points,o.includeSignDegree)),o.omitHouses||void 0===e.ascendant||(r+="\n\n"+i(o.houseSystem,e.ascendant,e.planets,o.omitPoints?[]:e.points,o.includeHouseDegree)),!o.omitAspects){const n=function(e,n){const t=[];for(let o=0;o<n.length;o++)for(let s=o+1;s<n.length;s++){const i=n[o],r=n[s];let a=Math.abs(i.degree-r.degree);a>180&&(a=360-a);for(const n of e){const e=Math.abs(a-n.angle);if(e<=n.orb){t.push({planetA:i.name,planetB:r.name,aspectType:n.name,orb:e});break}}}return t}(o.aspectDefinitions,e.planets);n.length>0&&(r+="\n\n"+function(e){const n=e.map((e=>`${e.planetA} is in ${e.aspectType} with ${e.planetB} (orb: ${e.orb.toFixed(1)}°)`)).join(". ");return n?`${n}.`:""}(n))}return r}e.default=r})(),o=o.default})()));
1
+ !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.chart2txt=n():e.chart2txt=n()}(this,(()=>(()=>{"use strict";var e={921:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DEFAULT_SETTINGS=n.DEFAULT_ASPECTS=n.ZODIAC_SIGNS=void 0,n.ZODIAC_SIGNS=["Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces"],n.DEFAULT_ASPECTS=[{name:"conjunction",angle:0,orb:5},{name:"opposition",angle:180,orb:5},{name:"trine",angle:120,orb:5},{name:"square",angle:90,orb:5},{name:"sextile",angle:60,orb:3}],n.DEFAULT_SETTINGS={includeSignDegree:!0,omitSigns:!1,houseSystem:"equal",includeHouseDegree:!1,omitHouses:!1,includeAscendant:!0,omitPoints:!1,aspectDefinitions:n.DEFAULT_ASPECTS,omitAspects:!1}}},n={};function t(o){var s=n[o];if(void 0!==s)return s.exports;var i=n[o]={exports:{}};return e[o](i,i.exports,t),i.exports}var o={};return(()=>{var e=o;const n=t(921);function s(e,t,o=[],s=n.DEFAULT_SETTINGS.includeSignDegree){const i=[...t?[{name:"Ascendant",degree:t}]:[],...e,...o].map((e=>{const t=function(e){const t=Math.floor(e/30)%12;return n.ZODIAC_SIGNS[t]}(e.degree);if(s){const n=Math.floor(e.degree%30);return`${e.name} is at ${n}° ${t}`}return`${e.name} is in ${t}`})).join(". ");return i?`${i}.`:""}function i(e,t,o,s=[],i=n.DEFAULT_SETTINGS.includeHouseDegree){const r=[...o,...s].map((n=>{const o=function(e,n,t){switch(e){case"equal":{const e=(n-t+360)%360;return{house:Math.floor(e/30)+1,degree:e%30}}case"whole_sign":{const e=(n-Math.floor(t/30)%12*30+360)%360;return{house:Math.floor(e/30)+1,degree:e%30}}}}(e,n.degree,t);return i?`${n.name} is at ${o.degree}° in house ${o.house}`:`${n.name} is in house ${o.house}`})).join(". ");return r?`${r}.`:""}function r(e,t={}){const o=Object.assign({},n.DEFAULT_SETTINGS,t);let r="Astrology Chart";const a=(c=e.location,u=e.timestamp,[c?`location: ${c}`:"",u?`at: ${u.toLocaleString()}`:""].filter((e=>""!==e)).join(", "));var c,u;if(a&&(r+=` (${a})`),r+=":\n\n",o.omitSigns||(r+=s(e.planets,o.includeAscendant&&e.ascendant?e.ascendant:void 0,o.omitPoints?[]:e.points,o.includeSignDegree)),o.omitHouses||void 0===e.ascendant||(r+="\n\n"+i(o.houseSystem,e.ascendant,e.planets,o.omitPoints?[]:e.points,o.includeHouseDegree)),!o.omitAspects){const n=function(e,n){const t=[];for(let o=0;o<n.length;o++)for(let s=o+1;s<n.length;s++){const i=n[o],r=n[s];let a=Math.abs(i.degree-r.degree);a>180&&(a=360-a);for(const n of e){const e=Math.abs(a-n.angle);if(e<=n.orb){t.push({planetA:i.name,planetB:r.name,aspectType:n.name,orb:e});break}}}return t}(o.aspectDefinitions,e.planets);n.length>0&&(r+="\n\n"+function(e){const n=e.map((e=>`${e.planetA} is in ${e.aspectType} with ${e.planetB} (orb: ${e.orb.toFixed(1)}°)`)).join(". ");return n?`${n}.`:""}(n))}return r}e.default=r})(),o=o.default})()));
package/dist/index.js CHANGED
@@ -122,7 +122,7 @@ function formatAspects(aspects) {
122
122
  */
123
123
  function formatLocationAndDate(location, timestamp) {
124
124
  const locationString = location ? `location: ${location}` : '';
125
- const timestampString = timestamp ? `at: ${timestamp.toISOString()}` : '';
125
+ const timestampString = timestamp ? `at: ${timestamp.toLocaleString()}` : '';
126
126
  return [locationString, timestampString].filter((s) => s !== '').join(', ');
127
127
  }
128
128
  /**
package/package.json CHANGED
@@ -1,45 +1,45 @@
1
- {
2
- "name": "chart2txt",
3
- "version": "0.3.0",
4
- "description": "Convert astrological chart data to human-readable text",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "browser": "dist/chart2txt.min.js",
8
- "scripts": {
9
- "build": "tsc && webpack",
10
- "build:tsc": "tsc",
11
- "build:webpack": "webpack",
12
- "test": "jest",
13
- "lint": "eslint src/**/*.ts",
14
- "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\""
15
- },
16
- "keywords": [
17
- "astrology",
18
- "chart",
19
- "text"
20
- ],
21
- "homepage": "https://github.com/simpolism/chart2txt",
22
- "author": "simpolism <simpolism@gmail.com>",
23
- "license": "MIT",
24
- "devDependencies": {
25
- "@types/jest": "^29.5.0",
26
- "@types/node": "^18.0.0",
27
- "@typescript-eslint/eslint-plugin": "^5.0.0",
28
- "@typescript-eslint/parser": "^5.0.0",
29
- "eslint": "^8.0.0",
30
- "eslint-config-prettier": "^8.0.0",
31
- "jest": "^29.0.0",
32
- "prettier": "^2.0.0",
33
- "ts-jest": "^29.1.0",
34
- "ts-loader": "^9.4.4",
35
- "typescript": "^5.0.0",
36
- "webpack": "^5.88.2",
37
- "webpack-cli": "^5.1.4",
38
- "terser-webpack-plugin": "^5.3.9"
39
- },
40
- "files": [
41
- "dist",
42
- "LICENSE",
43
- "README.md"
44
- ]
45
- }
1
+ {
2
+ "name": "chart2txt",
3
+ "version": "0.3.1",
4
+ "description": "Convert astrological chart data to human-readable text",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "browser": "dist/chart2txt.min.js",
8
+ "scripts": {
9
+ "build": "tsc && webpack",
10
+ "build:tsc": "tsc",
11
+ "build:webpack": "webpack",
12
+ "test": "jest",
13
+ "lint": "eslint src/**/*.ts",
14
+ "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\""
15
+ },
16
+ "keywords": [
17
+ "astrology",
18
+ "chart",
19
+ "text"
20
+ ],
21
+ "homepage": "https://github.com/simpolism/chart2txt",
22
+ "author": "simpolism <simpolism@gmail.com>",
23
+ "license": "MIT",
24
+ "devDependencies": {
25
+ "@types/jest": "^29.5.0",
26
+ "@types/node": "^18.0.0",
27
+ "@typescript-eslint/eslint-plugin": "^5.0.0",
28
+ "@typescript-eslint/parser": "^5.0.0",
29
+ "eslint": "^8.0.0",
30
+ "eslint-config-prettier": "^8.0.0",
31
+ "jest": "^29.0.0",
32
+ "prettier": "^2.0.0",
33
+ "ts-jest": "^29.1.0",
34
+ "ts-loader": "^9.4.4",
35
+ "typescript": "^5.0.0",
36
+ "webpack": "^5.88.2",
37
+ "webpack-cli": "^5.1.4",
38
+ "terser-webpack-plugin": "^5.3.9"
39
+ },
40
+ "files": [
41
+ "dist",
42
+ "LICENSE",
43
+ "README.md"
44
+ ]
45
+ }