@ideal-postcodes/jsutil
Advanced tools
Comparing version
import { AnyAddress, GbrAddress } from "./types"; | ||
import { SelectorNode, Targets, OutputFields, UsaOutputFields, LineCount, NamedFields } from "./types"; | ||
export declare const numberOfLines: (targets: Targets) => LineCount; | ||
export declare const join: (list: unknown[]) => string; | ||
export declare const join: (list: (string | unknown)[]) => string; | ||
export declare const charArrayLength: (arr: string[]) => number; | ||
@@ -14,3 +14,3 @@ interface MaxLengthOptions extends MaxLineConfig { | ||
export declare const toAddressLines: (lineCount: LineCount, address: AnyAddress, options: MaxLineConfig) => [string, string, string]; | ||
type KeysOfUnion<T> = T extends T ? keyof T : never; | ||
type KeysOfUnion<T> = T extends unknown ? keyof T : never; | ||
export declare const extract: (a: AnyAddress, attr: KeysOfUnion<AnyAddress>) => string; | ||
@@ -17,0 +17,0 @@ export declare const getFields: (o: PopulateAddressOptions) => OutputFields; |
@@ -258,2 +258,6 @@ "use strict"; | ||
continue; | ||
if (e.startsWith("native.")) { | ||
updateNative(e, fields, address, scope); | ||
continue; | ||
} | ||
if (address[e] === undefined) | ||
@@ -270,2 +274,17 @@ continue; | ||
exports.populateAddress = populateAddress; | ||
const updateNative = (nativeAttr, fields, address, scope) => { | ||
const e = nativeAttr.replace("native.", ""); | ||
const native = address.native; | ||
if (native === undefined) | ||
return; | ||
const nativeValue = native[e]; | ||
if (nativeValue === undefined) | ||
return; | ||
if (fields.hasOwnProperty(nativeAttr)) { | ||
const selector = fields[nativeAttr]; | ||
if (!selector) | ||
return; | ||
(0, input_1.update)((0, dom_1.toElem)(selector, scope), (0, exports.extract)(native, e)); | ||
} | ||
}; | ||
const removeOrganisation = (address) => { | ||
@@ -272,0 +291,0 @@ if (address.organisation_name.length === 0) |
import { AnyAddress, GbrAddress } from "./types"; | ||
import { SelectorNode, Targets, OutputFields, UsaOutputFields, LineCount, NamedFields } from "./types"; | ||
export declare const numberOfLines: (targets: Targets) => LineCount; | ||
export declare const join: (list: unknown[]) => string; | ||
export declare const join: (list: (string | unknown)[]) => string; | ||
export declare const charArrayLength: (arr: string[]) => number; | ||
@@ -14,3 +14,3 @@ interface MaxLengthOptions extends MaxLineConfig { | ||
export declare const toAddressLines: (lineCount: LineCount, address: AnyAddress, options: MaxLineConfig) => [string, string, string]; | ||
type KeysOfUnion<T> = T extends T ? keyof T : never; | ||
type KeysOfUnion<T> = T extends unknown ? keyof T : never; | ||
export declare const extract: (a: AnyAddress, attr: KeysOfUnion<AnyAddress>) => string; | ||
@@ -17,0 +17,0 @@ export declare const getFields: (o: PopulateAddressOptions) => OutputFields; |
@@ -244,2 +244,6 @@ import { isInputElem, update, change, isSelect, isInput, hasValue, optionsHasText, } from "./input"; | ||
continue; | ||
if (e.startsWith("native.")) { | ||
updateNative(e, fields, address, scope); | ||
continue; | ||
} | ||
if (address[e] === undefined) | ||
@@ -255,2 +259,17 @@ continue; | ||
}; | ||
const updateNative = (nativeAttr, fields, address, scope) => { | ||
const e = nativeAttr.replace("native.", ""); | ||
const native = address.native; | ||
if (native === undefined) | ||
return; | ||
const nativeValue = native[e]; | ||
if (nativeValue === undefined) | ||
return; | ||
if (fields.hasOwnProperty(nativeAttr)) { | ||
const selector = fields[nativeAttr]; | ||
if (!selector) | ||
return; | ||
update(toElem(selector, scope), extract(native, e)); | ||
} | ||
}; | ||
export const removeOrganisation = (address) => { | ||
@@ -257,0 +276,0 @@ if (address.organisation_name.length === 0) |
{ | ||
"name": "@ideal-postcodes/jsutil", | ||
"version": "7.3.0", | ||
"version": "7.4.0", | ||
"description": "Browser Address Autocomplete for api.ideal-postcodes.co.uk", | ||
@@ -33,5 +33,3 @@ "author": { | ||
"browserslist": [ | ||
"ie 11", | ||
"last 2 versions", | ||
"not IE 10" | ||
"last 2 versions" | ||
], | ||
@@ -104,4 +102,4 @@ "files": [ | ||
"devDependencies": { | ||
"@babel/core": "~7.18.10", | ||
"@babel/preset-env": "~7.16.5", | ||
"@babel/core": "~7.23.9", | ||
"@babel/preset-env": "~7.23.9", | ||
"@cablanchard/semantic-release": "~1.3.4", | ||
@@ -112,13 +110,12 @@ "@cablanchard/tsconfig": "~2.0.0", | ||
"@ideal-postcodes/supported-browsers": "~2.5.0", | ||
"@types/chai": "~4.3.0", | ||
"@types/karma": "~6.3.0", | ||
"@types/mocha": "~9.1.0", | ||
"@types/node": "~20.8.8", | ||
"@types/prettier": "~2.7.0", | ||
"agadoo": "~2.0.0", | ||
"babel": "~6.23.0", | ||
"chai": "~4.3.0", | ||
"codecov": "~3.8.0", | ||
"core-js": "~3.24.1", | ||
"dotenv": "~16.0.0", | ||
"@types/chai": "~4.3.11", | ||
"@types/karma": "~6.3.8", | ||
"@types/mocha": "~10.0.6", | ||
"@types/node": "~20.11.19", | ||
"@types/prettier": "~3.0.0", | ||
"agadoo": "~3.0.0", | ||
"chai": "~5.0.3", | ||
"codecov": "~3.8.3", | ||
"core-js": "~3.36.0", | ||
"dotenv": "~16.4.4", | ||
"karma": "~6.4.3", | ||
@@ -133,11 +130,11 @@ "karma-babel-preprocessor": "~8.0.2", | ||
"nyc": "~15.1.0", | ||
"prettier": "~2.7.1", | ||
"puppeteer": "~21.0.3", | ||
"regenerator-runtime": "~0.13.5", | ||
"semantic-release": "~19.0.3", | ||
"source-map-support": "~0.5.19", | ||
"prettier": "~3.2.5", | ||
"puppeteer": "~22.1.0", | ||
"regenerator-runtime": "~0.14.1", | ||
"semantic-release": "~23.0.2", | ||
"source-map-support": "~0.5.21", | ||
"ts-node": "~10.9.2", | ||
"typescript": "~5.4.5", | ||
"cypress": "~13.10.0" | ||
"typescript": "~5.3.3", | ||
"cypress": "~13.6.4" | ||
} | ||
} |
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
93865
1.33%34
-2.86%2616
1.47%