@ph-dev-utils/business
v0.1.0
Published
Philippine SEC company/partnership registration-number validator and parser — recognizes the CS/CN/A/FS/FN/PG prefix + year + sequence formats and labels the entity type. Pairs with @ph-dev-utils/psic for industry.
Maintainers
Readme
@ph-dev-utils/business
Validate and parse Philippine SEC registration numbers in JavaScript/TypeScript — recognizes the CS / CN / A / FS / FN / PG prefix + year + sequence formats and labels the entity type. Zero-dependency and browser-safe. Part of the @ph-dev-utils family.
Format-level only. This checks the structure of a registration number and infers the entity type from the prefix. It is not a registry lookup — always confirm a company against the SEC verification portal.
npm install @ph-dev-utils/businessQuick start
import { validateSEC, parseSEC, entityTypeOf, formatSEC } from '@ph-dev-utils/business';
validateSEC('CS2019-12345'); // true
validateSEC('cs201912345'); // true (dashes/spaces/case ignored)
validateSEC('12345678'); // false (purely numeric legacy certs are out of scope)
parseSEC('CS2019-12345');
// {
// prefix: 'CS', entityType: 'corporation',
// entityLabel: 'Stock or non-stock corporation (unified)', era: '2013–present',
// year: 2019, sequence: '12345', formatted: 'CS2019-12345', raw: 'CS2019-12345'
// }
entityTypeOf('PG2018-00042'); // 'partnership'
formatSEC('cs 2019 12345'); // 'CS2019-12345' (canonical form)API
| Function | Returns |
| --- | --- |
| validateSEC(input) | boolean — matches a recognized SEC reg-number structure |
| parseSEC(input) | ParsedSec \| null — prefix, entity type, year, sequence, canonical form |
| entityTypeOf(input) | EntityType \| null |
| formatSEC(input) | string \| null — canonical PREFIX + YEAR-SEQUENCE |
| SEC_PREFIXES | the documented prefix table (prefix, entityType, label, era) |
Recognized prefixes
| Prefix | Entity type | Era |
| --- | --- | --- |
| CS | Stock or non-stock corporation (unified) | 2013–present |
| CN | Non-stock corporation (legacy) | 1986–2012 |
| A | Stock corporation (legacy) | pre-2000 |
| FS | Foreign stock corporation / branch | 2000–present |
| FN | Foreign non-stock corporation | 2000–present |
| PG | Partnership | 2017–present |
The recognized structure is prefix + 4-digit year (19xx/20xx) + 3–8 digit sequence, e.g. CS2019-12345. Entity-type labels are a best-effort reading of public SEC guidance — prefixes and their meanings have shifted across eras, so treat them as indicative.
Industry classification
To tag a company's industry, pair this with @ph-dev-utils/psic (Philippine Standard Industrial Classification — sections + divisions).
License
MIT. SEC registration-number formats are factual public information; not affiliated with the Philippine SEC.
