@tpmjs/official-policy-doc-format 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +10 -10
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -116,21 +116,21 @@ function extractPurpose(content) {
116
116
  const purposeMatch = content.match(
117
117
  /(?:purpose|objective|intent)[\s:]+(.+?)(?=\n\n|scope|policy|$)/is
118
118
  );
119
- if (purposeMatch && purposeMatch[1]) {
119
+ if (purposeMatch?.[1]) {
120
120
  return purposeMatch[1].trim();
121
121
  }
122
122
  return "This policy establishes guidelines and procedures to ensure consistency, compliance, and best practices within the organization.";
123
123
  }
124
124
  function extractScope(content) {
125
125
  const scopeMatch = content.match(/scope[\s:]+(.+?)(?=\n\n|policy|procedure|$)/is);
126
- if (scopeMatch && scopeMatch[1]) {
126
+ if (scopeMatch?.[1]) {
127
127
  return scopeMatch[1].trim();
128
128
  }
129
129
  return "This policy applies to all employees, contractors, and other personnel associated with the organization.";
130
130
  }
131
131
  function extractPolicyStatement(content) {
132
132
  const statementMatch = content.match(/policy[\s:]+(.+?)(?=\n\n|procedure|$)/is);
133
- if (statementMatch && statementMatch[1]) {
133
+ if (statementMatch?.[1]) {
134
134
  return statementMatch[1].trim();
135
135
  }
136
136
  const paragraphs = content.split("\n\n").filter((p) => p.trim().length > 50);
@@ -139,7 +139,7 @@ function extractPolicyStatement(content) {
139
139
  function extractProcedures(content) {
140
140
  const procedures = [];
141
141
  const procedureSection = content.match(/procedure[s]?[\s:]+(.+?)(?=\n\n[A-Z]|$)/is);
142
- if (procedureSection && procedureSection[1]) {
142
+ if (procedureSection?.[1]) {
143
143
  const text = procedureSection[1];
144
144
  const matches = text.match(/(?:^|\n)\s*(?:\d+\.|[-*])\s*(.+)/gm);
145
145
  if (matches) {
@@ -159,7 +159,7 @@ function extractProcedures(content) {
159
159
  function extractResponsibilities(content) {
160
160
  const responsibilities = {};
161
161
  const respMatch = content.match(/responsibilit(?:ies|y)[\s:]+(.+?)(?=\n\n[A-Z]|$)/is);
162
- if (respMatch && respMatch[1]) {
162
+ if (respMatch?.[1]) {
163
163
  const text = respMatch[1];
164
164
  const roleMatches = text.matchAll(/([A-Za-z\s]+?)[:]\s*(.+?)(?=\n[A-Z]|$)/gs);
165
165
  for (const match of roleMatches) {
@@ -172,11 +172,11 @@ function extractResponsibilities(content) {
172
172
  }
173
173
  }
174
174
  if (Object.keys(responsibilities).length === 0) {
175
- responsibilities["Employees"] = [
175
+ responsibilities.Employees = [
176
176
  "Comply with policy requirements",
177
177
  "Report violations or concerns"
178
178
  ];
179
- responsibilities["Managers"] = [
179
+ responsibilities.Managers = [
180
180
  "Ensure team compliance",
181
181
  "Address policy violations",
182
182
  "Provide guidance and support"
@@ -192,7 +192,7 @@ function extractResponsibilities(content) {
192
192
  function extractDefinitions(content) {
193
193
  const definitions = /* @__PURE__ */ new Map();
194
194
  const defMatch = content.match(/definition[s]?[\s:]+(.+?)(?=\n\n[A-Z]|$)/is);
195
- if (defMatch && defMatch[1]) {
195
+ if (defMatch?.[1]) {
196
196
  const text = defMatch[1];
197
197
  const termMatches = text.matchAll(/([A-Za-z\s]+?)[:]\s*(.+?)(?=\n|$)/g);
198
198
  for (const match of termMatches) {
@@ -208,7 +208,7 @@ function extractDefinitions(content) {
208
208
  function extractRelatedPolicies(content) {
209
209
  const policies = [];
210
210
  const relatedMatch = content.match(/related\s+polic(?:ies|y)[\s:]+(.+?)(?=\n\n|$)/is);
211
- if (relatedMatch && relatedMatch[1]) {
211
+ if (relatedMatch?.[1]) {
212
212
  const text = relatedMatch[1];
213
213
  const policyMatches = text.match(/(?:^|\n)\s*(?:\d+\.|[-*])\s*(.+)/gm);
214
214
  if (policyMatches) {
@@ -219,7 +219,7 @@ function extractRelatedPolicies(content) {
219
219
  }
220
220
  function extractEnforcement(content) {
221
221
  const enforcementMatch = content.match(/enforcement|violation[s]?[\s:]+(.+?)(?=\n\n|$)/is);
222
- if (enforcementMatch && enforcementMatch[1]) {
222
+ if (enforcementMatch?.[1]) {
223
223
  return enforcementMatch[1].trim();
224
224
  }
225
225
  return "Violations of this policy may result in disciplinary action up to and including termination of employment. The severity of disciplinary action will depend on the nature and circumstances of the violation.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tpmjs/official-policy-doc-format",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Formats HR policy content into standardized policy document structure",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -20,7 +20,7 @@
20
20
  "dist"
21
21
  ],
22
22
  "devDependencies": {
23
- "tsup": "^8.3.5",
23
+ "tsup": "^8.5.1",
24
24
  "typescript": "^5.9.3",
25
25
  "@tpmjs/tsconfig": "0.0.0"
26
26
  },
@@ -65,7 +65,7 @@
65
65
  ]
66
66
  },
67
67
  "dependencies": {
68
- "ai": "6.0.0-beta.124"
68
+ "ai": "6.0.49"
69
69
  },
70
70
  "scripts": {
71
71
  "build": "tsup",