Skip to content

Commit

Permalink
fix: separate zip code values for number vs single line text fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevee committed Jan 17, 2024
1 parent fb602db commit 6fede5e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.4] - 2024-01-17

### Fixed

- Added separate zip code generator for handling single line text vs. number fields.

## [0.0.3] - 2022-10-25

### Added
Expand Down
2 changes: 2 additions & 0 deletions frontend/lib/generators/generators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import EmailHumanGenerator from './email-human'
import AddressGenerator from './address'
import CityGenerator from './city'
import ZipGenerator from './zip'
import ZipStringGenerator from './zip-string'
import StateAbbreviationGenerator from './state-abbreviation'
import StateNameGenerator from './state-name'
import CheckboxGenerator from './checkbox'
Expand Down Expand Up @@ -40,6 +41,7 @@ const generators = [
AddressGenerator,
CityGenerator,
ZipGenerator,
ZipStringGenerator,
StateAbbreviationGenerator,
StateNameGenerator,
CheckboxGenerator,
Expand Down
11 changes: 11 additions & 0 deletions frontend/lib/generators/generators/zip-string.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { FieldType } from '@airtable/blocks/models'
import Generator from './generator'

const ZipStringGenerator = (): Generator => ({
id: 'zip-string',
name: 'Zip code',
types: [FieldType.SINGLE_LINE_TEXT],
generate: () => (Math.floor(Math.random() * 90000) + 10000).toString(),
})

export default ZipStringGenerator
2 changes: 1 addition & 1 deletion frontend/lib/generators/generators/zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Generator from './generator'
const ZipGenerator = (): Generator => ({
id: 'zip',
name: 'Zip code',
types: [FieldType.SINGLE_LINE_TEXT, FieldType.NUMBER],
types: [FieldType.NUMBER],
generate: () => Math.floor(Math.random() * 90000) + 10000,
})

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "airtable-extension-random-record-generator",
"description": "Randomly generates Airtable records",
"license": "Apache-2.0",
"version": "0.0.4",
"scripts": {
"lint": "eslint --ext .js,.jsx,.ts,.tsx frontend test",
"test": "npm run lint && npm run test:jsdom",
Expand Down

0 comments on commit 6fede5e

Please sign in to comment.