|
@@ -11,6 +11,8 @@ import { FieldDefinition, FieldType } from 'mol-io/writer/cif/encoder'
|
|
|
const intRegex = /^-?\d+$/
|
|
|
const floatRegex = /^-?(([0-9]+)[.]?|([0-9]*[.][0-9]+))([(][0-9]+[)])?([eE][+-]?[0-9]+)?/
|
|
|
|
|
|
+// Classify a cif field as str, int or float based the data it contains.
|
|
|
+// To classify a field as int or float all items are checked.
|
|
|
function classify(name: string, field: Field): FieldDefinition {
|
|
|
let floatCount = 0, hasString = false;
|
|
|
for (let i = 0, _i = field.rowCount; i < _i; i++) {
|