@nfdi4plants/arctrl 1.2.0 → 2.0.0-alpha.2
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.
- package/ARC.js +53 -35
- package/{Contracts/Contracts.ARCtrl.js → Contract/ARC.js} +4 -2
- package/Contract/ArcAssay.js +102 -0
- package/Contract/ArcInvestigation.js +78 -0
- package/Contract/ArcStudy.js +102 -0
- package/Contract/Contract.js +3 -3
- package/{Contracts/Contracts.Git.js → Contract/Git.js} +5 -5
- package/{ISA/ISA/ArcTypes → Core}/ArcTypes.js +307 -295
- package/Core/Comment.js +97 -0
- package/{ISA/ISA/JsonTypes → Core}/CommentList.js +12 -18
- package/Core/Conversion.js +1056 -0
- package/Core/Helper/Collections.js +318 -0
- package/Core/Helper/HashCodes.js +39 -0
- package/{ISA/ISA → Core/Helper}/Identifier.js +67 -2
- package/{ISA/ISA → Core/Helper}/Regex.js +3 -3
- package/{SemVer.js → Core/Helper/SemVer.js} +8 -8
- package/{ISA/ISA/ArcTypes → Core}/IdentifierSetters.js +1 -1
- package/Core/OntologyAnnotation.js +186 -0
- package/Core/OntologySourceReference.js +92 -0
- package/Core/Person.js +194 -0
- package/Core/Process/ColumnIndex.js +248 -0
- package/Core/Process/Component.js +188 -0
- package/{ISA/ISA/JsonTypes → Core/Process}/Data.js +8 -8
- package/{ISA/ISA/JsonTypes → Core/Process}/DataFile.js +3 -3
- package/Core/Process/Factor.js +109 -0
- package/{ISA/ISA/JsonTypes → Core/Process}/FactorValue.js +32 -13
- package/{ISA/ISA/JsonTypes → Core/Process}/Material.js +9 -9
- package/{ISA/ISA/JsonTypes → Core/Process}/MaterialAttribute.js +17 -17
- package/{ISA/ISA/JsonTypes → Core/Process}/MaterialAttributeValue.js +35 -16
- package/{ISA/ISA/JsonTypes → Core/Process}/MaterialType.js +3 -3
- package/{ISA/ISA/JsonTypes → Core/Process}/Process.js +46 -79
- package/{ISA/ISA/JsonTypes → Core/Process}/ProcessInput.js +42 -42
- package/{ISA/ISA/JsonTypes → Core/Process}/ProcessOutput.js +36 -36
- package/{ISA/ISA/JsonTypes → Core/Process}/ProcessParameterValue.js +26 -7
- package/{ISA/ISA/JsonTypes → Core/Process}/ProcessSequence.js +21 -25
- package/{ISA/ISA/JsonTypes → Core/Process}/Protocol.js +26 -57
- package/{ISA/ISA/JsonTypes → Core/Process}/ProtocolParameter.js +10 -10
- package/{ISA/ISA/JsonTypes → Core/Process}/Sample.js +12 -12
- package/{ISA/ISA/JsonTypes → Core/Process}/Source.js +9 -9
- package/{ISA/ISA/JsonTypes → Core/Process}/Value.js +13 -13
- package/Core/Publication.js +116 -0
- package/{ISA/ISA/ArcTypes → Core/Table}/ArcTable.js +43 -149
- package/Core/Table/ArcTableAux.js +532 -0
- package/{ISA/ISA/ArcTypes → Core/Table}/ArcTables.js +20 -32
- package/{ISA/ISA/ArcTypes → Core/Table}/CompositeCell.js +19 -76
- package/{ISA/ISA/ArcTypes → Core/Table}/CompositeColumn.js +6 -6
- package/{ISA/ISA/ArcTypes → Core/Table}/CompositeHeader.js +14 -34
- package/{Templates → Core}/Template.js +16 -17
- package/Core/Templates.js +84 -0
- package/FileSystem/Commit.js +2 -2
- package/FileSystem/FileSystem.js +4 -4
- package/FileSystem/FileSystemTree.js +46 -8
- package/FileSystem/Path.js +10 -2
- package/Json/ARC.js +25 -0
- package/Json/Assay.js +202 -0
- package/Json/Comment.js +130 -0
- package/Json/ConverterOptions.js +18 -0
- package/Json/Decode.js +128 -0
- package/Json/Encode.js +45 -0
- package/Json/Investigation.js +220 -0
- package/Json/OntologyAnnotation.js +169 -0
- package/Json/OntologySourceReference.js +122 -0
- package/Json/Person.js +250 -0
- package/Json/Process/AssayMaterials.js +22 -0
- package/Json/Process/Component.js +79 -0
- package/Json/Process/Data.js +102 -0
- package/Json/Process/DataFile.js +81 -0
- package/Json/Process/Factor.js +48 -0
- package/Json/Process/FactorValue.js +53 -0
- package/Json/Process/Material.js +107 -0
- package/Json/Process/MaterialAttribute.js +45 -0
- package/Json/Process/MaterialAttributeValue.js +70 -0
- package/Json/Process/MaterialType.js +60 -0
- package/Json/Process/Process.js +107 -0
- package/Json/Process/ProcessInput.js +59 -0
- package/Json/Process/ProcessOutput.js +71 -0
- package/Json/Process/ProcessParameterValue.js +69 -0
- package/Json/Process/ProcessSequence.js +53 -0
- package/Json/Process/PropertyValue.js +82 -0
- package/Json/Process/Protocol.js +147 -0
- package/Json/Process/ProtocolParameter.js +45 -0
- package/Json/Process/Sample.js +134 -0
- package/Json/Process/Source.js +101 -0
- package/Json/Process/StudyMaterials.js +24 -0
- package/Json/Process/Value.js +42 -0
- package/Json/Publication.js +142 -0
- package/Json/StringTable.js +44 -0
- package/Json/Study.js +306 -0
- package/{ISA/ISA.Json/ArcTypes → Json/Table}/ArcTable.js +53 -49
- package/Json/Table/CellTable.js +40 -0
- package/Json/Table/CompositeCell.js +65 -0
- package/{ISA/ISA.Json/ArcTypes → Json/Table}/CompositeHeader.js +22 -19
- package/Json/Table/Compression.js +38 -0
- package/Json/Table/IOType.js +37 -0
- package/Json/Table/OATable.js +40 -0
- package/Json/Table/Templates.js +107 -0
- package/Json/context/rocrate/isa_assay_context.js +32 -0
- package/Json/context/rocrate/isa_comment_context.js +23 -0
- package/Json/context/rocrate/isa_component_context.js +24 -0
- package/Json/context/rocrate/isa_data_context.js +25 -0
- package/Json/context/rocrate/isa_factor_context.js +25 -0
- package/Json/context/rocrate/isa_factor_value_context.js +23 -0
- package/{ISA/ISA.Json → Json}/context/rocrate/isa_investigation_context.js +5 -5
- package/{ISA/ISA.Json → Json}/context/rocrate/isa_material_attribute_context.js +4 -4
- package/Json/context/rocrate/isa_material_attribute_value_context.js +23 -0
- package/Json/context/rocrate/isa_material_context.js +26 -0
- package/Json/context/rocrate/isa_ontology_annotation_context.js +23 -0
- package/Json/context/rocrate/isa_ontology_source_reference_context.js +26 -0
- package/Json/context/rocrate/isa_organization_context.js +22 -0
- package/Json/context/rocrate/isa_person_context.js +33 -0
- package/Json/context/rocrate/isa_process_context.js +29 -0
- package/Json/context/rocrate/isa_process_parameter_value_context.js +23 -0
- package/Json/context/rocrate/isa_protocol_context.js +28 -0
- package/{ISA/ISA.Json → Json}/context/rocrate/isa_protocol_parameter_context.js +4 -4
- package/Json/context/rocrate/isa_publication_context.js +25 -0
- package/Json/context/rocrate/isa_sample_context.js +24 -0
- package/Json/context/rocrate/isa_source_context.js +25 -0
- package/Json/context/rocrate/isa_study_context.js +40 -0
- package/Json/context/rocrate/property_value_context.js +4 -0
- package/Json/context/rocrate/rocrate_context.js +23 -0
- package/Json.js +193 -0
- package/README.md +33 -12
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/AnnotationTable/ArcTable.js +12 -12
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/AnnotationTable/CompositeCell.js +8 -7
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/AnnotationTable/CompositeColumn.js +10 -10
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/AnnotationTable/CompositeHeader.js +10 -10
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/ArcAssay.js +11 -11
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/ArcInvestigation.js +34 -37
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/ArcStudy.js +12 -12
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/CollectionAux.js +7 -7
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/Metadata/Assays.js +32 -32
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/Metadata/Comment.js +5 -5
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/Metadata/Contacts.js +28 -30
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/Metadata/Conversions.js +22 -16
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/Metadata/DesignDescriptors.js +1 -1
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/Metadata/Factors.js +23 -22
- package/Spreadsheet/Metadata/OntologyAnnotation.js +64 -0
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/Metadata/OntologySourceReference.js +22 -24
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/Metadata/Protocols.js +17 -17
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/Metadata/Publication.js +29 -31
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/Metadata/SparseTable.js +23 -22
- package/{ISA/ISA.Spreadsheet → Spreadsheet}/Metadata/Study.js +38 -40
- package/{Templates/Template.Spreadsheet.js → Spreadsheet/Template.js} +31 -31
- package/Template.Web.js +27 -0
- package/WebRequest/WebRequest.Node.js +2 -2
- package/WebRequest/WebRequest.js +2 -2
- package/Xlsx.js +85 -0
- package/fable_modules/Fable.Fetch.2.6.0/Fetch.fs.js +7 -7
- package/fable_modules/Fable.Promise.2.2.2/Promise.fs.js +3 -3
- package/fable_modules/Fable.SimpleHttp.3.5.0/Http.fs.js +8 -8
- package/fable_modules/Fable.SimpleHttp.3.5.0/Types.fs.js +2 -2
- package/fable_modules/FsSpreadsheet.5.1.3/Cells/FsCell.fs.js +14 -14
- package/fable_modules/FsSpreadsheet.5.1.3/Cells/FsCellsCollection.fs.js +6 -6
- package/fable_modules/FsSpreadsheet.5.1.3/DSL/CellBuilder.fs.js +4 -4
- package/fable_modules/FsSpreadsheet.5.1.3/DSL/ColumnBuilder.fs.js +3 -3
- package/fable_modules/FsSpreadsheet.5.1.3/DSL/DSL.fs.js +2 -2
- package/fable_modules/FsSpreadsheet.5.1.3/DSL/Expression.fs.js +1 -1
- package/fable_modules/FsSpreadsheet.5.1.3/DSL/RowBuilder.fs.js +3 -3
- package/fable_modules/FsSpreadsheet.5.1.3/DSL/SheetBuilder.fs.js +3 -3
- package/fable_modules/FsSpreadsheet.5.1.3/DSL/TableBuilder.fs.js +3 -3
- package/fable_modules/FsSpreadsheet.5.1.3/DSL/Transform.fs.js +6 -6
- package/fable_modules/FsSpreadsheet.5.1.3/DSL/Types.fs.js +4 -4
- package/fable_modules/FsSpreadsheet.5.1.3/DSL/WorkbookBuilder.fs.js +3 -3
- package/fable_modules/FsSpreadsheet.5.1.3/FsAddress.fs.js +8 -8
- package/fable_modules/FsSpreadsheet.5.1.3/FsColumn.fs.js +3 -3
- package/fable_modules/FsSpreadsheet.5.1.3/FsRow.fs.js +3 -3
- package/fable_modules/FsSpreadsheet.5.1.3/FsWorkbook.fs.js +6 -6
- package/fable_modules/FsSpreadsheet.5.1.3/FsWorksheet.fs.js +9 -9
- package/fable_modules/FsSpreadsheet.5.1.3/Ranges/FsRange.fs.js +3 -3
- package/fable_modules/FsSpreadsheet.5.1.3/Ranges/FsRangeAddress.fs.js +3 -3
- package/fable_modules/FsSpreadsheet.5.1.3/Ranges/FsRangeBase.fs.js +3 -3
- package/fable_modules/FsSpreadsheet.5.1.3/Ranges/FsRangeColumn.fs.js +3 -3
- package/fable_modules/FsSpreadsheet.5.1.3/Ranges/FsRangeRow.fs.js +1 -1
- package/fable_modules/FsSpreadsheet.5.1.3/SheetBuilder.fs.js +8 -8
- package/fable_modules/FsSpreadsheet.5.1.3/Tables/FsTable.fs.js +7 -7
- package/fable_modules/FsSpreadsheet.5.1.3/Tables/FsTableField.fs.js +4 -4
- package/fable_modules/FsSpreadsheet.5.1.3/Tables/FsTableRow.fs.js +1 -1
- package/fable_modules/Thoth.Json.Core.0.2.1/Decode.fs.js +19 -19
- package/fable_modules/Thoth.Json.Core.0.2.1/Encode.fs.js +5 -5
- package/fable_modules/Thoth.Json.Core.0.2.1/Types.fs.js +2 -2
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/Decode.fs.js +1 -1
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/Encode.fs.js +2 -2
- package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Boolean.js +2 -2
- package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/CHANGELOG.md +18 -0
- package/fable_modules/fable-library-js.4.16.0/ConditionalWeakTable.d.ts +9 -0
- package/fable_modules/fable-library-js.4.16.0/ConditionalWeakTable.js +21 -0
- package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Date.js +337 -40
- package/fable_modules/fable-library-js.4.16.0/MapUtil.d.ts +12 -0
- package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/MapUtil.js +15 -0
- package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Util.d.ts +6 -3
- package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Util.js +2 -13
- package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/package.json +1 -1
- package/fable_modules/project_cracked.json +1 -1
- package/index.js +14 -12
- package/package.json +1 -1
- package/Contracts/Contracts.ArcTypes.js +0 -268
- package/FileSystemTree.js +0 -51
- package/ISA/ISA/ArcTypes/ArcTableAux.js +0 -1155
- package/ISA/ISA/ArcTypes/CompositeRow.js +0 -111
- package/ISA/ISA/Builder/Types.js +0 -243
- package/ISA/ISA/Fable.js +0 -123
- package/ISA/ISA/Helper.js +0 -505
- package/ISA/ISA/JsonTypes/Assay.js +0 -620
- package/ISA/ISA/JsonTypes/AssayMaterials.js +0 -39
- package/ISA/ISA/JsonTypes/ColumnIndex.js +0 -246
- package/ISA/ISA/JsonTypes/Comment.js +0 -58
- package/ISA/ISA/JsonTypes/Component.js +0 -165
- package/ISA/ISA/JsonTypes/Factor.js +0 -128
- package/ISA/ISA/JsonTypes/Investigation.js +0 -204
- package/ISA/ISA/JsonTypes/OntologyAnnotation.js +0 -196
- package/ISA/ISA/JsonTypes/OntologySourceReference.js +0 -85
- package/ISA/ISA/JsonTypes/Person.js +0 -152
- package/ISA/ISA/JsonTypes/Publication.js +0 -105
- package/ISA/ISA/JsonTypes/Study.js +0 -942
- package/ISA/ISA/JsonTypes/StudyMaterials.js +0 -45
- package/ISA/ISA/UIHelper.js +0 -19
- package/ISA/ISA.Json/ArcTypes/ArcAssay.js +0 -303
- package/ISA/ISA.Json/ArcTypes/ArcInvestigation.js +0 -122
- package/ISA/ISA.Json/ArcTypes/ArcStudy.js +0 -203
- package/ISA/ISA.Json/ArcTypes/CellTable.js +0 -40
- package/ISA/ISA.Json/ArcTypes/CompositeCell.js +0 -62
- package/ISA/ISA.Json/ArcTypes/IOType.js +0 -33
- package/ISA/ISA.Json/ArcTypes/OATable.js +0 -42
- package/ISA/ISA.Json/Assay.js +0 -129
- package/ISA/ISA.Json/Comment.js +0 -80
- package/ISA/ISA.Json/ConverterOptions.js +0 -51
- package/ISA/ISA.Json/Data.js +0 -253
- package/ISA/ISA.Json/Decode.js +0 -61
- package/ISA/ISA.Json/Factor.js +0 -194
- package/ISA/ISA.Json/GEncode.js +0 -40
- package/ISA/ISA.Json/Investigation.js +0 -89
- package/ISA/ISA.Json/Material.js +0 -232
- package/ISA/ISA.Json/Ontology.js +0 -200
- package/ISA/ISA.Json/Person.js +0 -186
- package/ISA/ISA.Json/Process.js +0 -305
- package/ISA/ISA.Json/Protocol.js +0 -281
- package/ISA/ISA.Json/Publication.js +0 -86
- package/ISA/ISA.Json/StringTable.js +0 -44
- package/ISA/ISA.Json/Study.js +0 -186
- package/ISA/ISA.Json/context/rocrate/isa_assay_context.js +0 -34
- package/ISA/ISA.Json/context/rocrate/isa_comment_context.js +0 -23
- package/ISA/ISA.Json/context/rocrate/isa_component_context.js +0 -24
- package/ISA/ISA.Json/context/rocrate/isa_data_context.js +0 -25
- package/ISA/ISA.Json/context/rocrate/isa_factor_context.js +0 -25
- package/ISA/ISA.Json/context/rocrate/isa_factor_value_context.js +0 -25
- package/ISA/ISA.Json/context/rocrate/isa_material_attribute_value_context.js +0 -25
- package/ISA/ISA.Json/context/rocrate/isa_material_context.js +0 -26
- package/ISA/ISA.Json/context/rocrate/isa_ontology_annotation_context.js +0 -25
- package/ISA/ISA.Json/context/rocrate/isa_ontology_source_reference_context.js +0 -26
- package/ISA/ISA.Json/context/rocrate/isa_organization_context.js +0 -22
- package/ISA/ISA.Json/context/rocrate/isa_person_context.js +0 -31
- package/ISA/ISA.Json/context/rocrate/isa_process_context.js +0 -31
- package/ISA/ISA.Json/context/rocrate/isa_process_parameter_value_context.js +0 -25
- package/ISA/ISA.Json/context/rocrate/isa_protocol_context.js +0 -30
- package/ISA/ISA.Json/context/rocrate/isa_publication_context.js +0 -27
- package/ISA/ISA.Json/context/rocrate/isa_sample_context.js +0 -26
- package/ISA/ISA.Json/context/rocrate/isa_source_context.js +0 -25
- package/ISA/ISA.Json/context/rocrate/isa_study_context.js +0 -42
- package/ISA/ISA.Json/context/rocrate/rocrate_context.js +0 -25
- package/ISA/ISA.Spreadsheet/Metadata/OntologyAnnotation.js +0 -65
- package/Path.js +0 -10
- package/Templates/Template.Json.js +0 -90
- package/Templates/Template.Web.js +0 -27
- package/Templates/Templates.js +0 -82
- package/fable_modules/fable-library-js.4.13.0/MapUtil.d.ts +0 -10
- /package/{ISA/ISA/JsonTypes → Core}/URI.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Array.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Array.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Async.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Async.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/AsyncBuilder.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/AsyncBuilder.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/BigInt.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/BigInt.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/BitConverter.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/BitConverter.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Boolean.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Char.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Char.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Choice.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Choice.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Date.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/DateOffset.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/DateOffset.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/DateOnly.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/DateOnly.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Decimal.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Decimal.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Double.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Double.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Encoding.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Encoding.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Event.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Event.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/FSharp.Collections.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/FSharp.Collections.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/FSharp.Core.CompilerServices.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/FSharp.Core.CompilerServices.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/FSharp.Core.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/FSharp.Core.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Global.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Global.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Guid.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Guid.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Int32.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Int32.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/List.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/List.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Long.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Long.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/MailboxProcessor.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/MailboxProcessor.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Map.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Map.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/MutableMap.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/MutableMap.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/MutableSet.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/MutableSet.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Native.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Native.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Numeric.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Numeric.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Observable.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Observable.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Option.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Option.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/README.md +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Random.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Random.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Range.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Range.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Reflection.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Reflection.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/RegExp.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/RegExp.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Result.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Result.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Seq.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Seq.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Seq2.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Seq2.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Set.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Set.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/String.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/String.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/System.Collections.Generic.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/System.Collections.Generic.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/System.Text.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/System.Text.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/SystemException.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/SystemException.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/TimeOnly.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/TimeOnly.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/TimeSpan.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/TimeSpan.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Timer.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Timer.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Types.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Types.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Unicode.13.0.0.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Unicode.13.0.0.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Uri.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/Uri.js +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/big.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/lib/big.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.13.0 → fable-library-js.4.16.0}/lib/big.js +0 -0
|
@@ -9,6 +9,342 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { toInt64, toFloat64 } from "./BigInt.js";
|
|
11
11
|
import { compareDates, dateOffset, padWithZeros } from "./Util.js";
|
|
12
|
+
const shortDays = [
|
|
13
|
+
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
|
14
|
+
];
|
|
15
|
+
const longDays = [
|
|
16
|
+
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
|
17
|
+
];
|
|
18
|
+
const shortMonths = [
|
|
19
|
+
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
|
20
|
+
];
|
|
21
|
+
const longMonths = [
|
|
22
|
+
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
|
|
23
|
+
];
|
|
24
|
+
function parseRepeatToken(format, pos, patternChar) {
|
|
25
|
+
let tokenLength = 0;
|
|
26
|
+
let internalPos = pos;
|
|
27
|
+
while (internalPos < format.length && format[internalPos] === patternChar) {
|
|
28
|
+
internalPos++;
|
|
29
|
+
tokenLength++;
|
|
30
|
+
}
|
|
31
|
+
return tokenLength;
|
|
32
|
+
}
|
|
33
|
+
function parseNextChar(format, pos) {
|
|
34
|
+
if (pos >= format.length - 1) {
|
|
35
|
+
return -1;
|
|
36
|
+
}
|
|
37
|
+
return format.charCodeAt(pos + 1);
|
|
38
|
+
}
|
|
39
|
+
function parseQuotedString(format, pos) {
|
|
40
|
+
let beginPos = pos;
|
|
41
|
+
// Get the character used to quote the string
|
|
42
|
+
const quoteChar = format[pos];
|
|
43
|
+
let result = "";
|
|
44
|
+
let foundQuote = false;
|
|
45
|
+
while (pos < format.length) {
|
|
46
|
+
pos++;
|
|
47
|
+
const currentChar = format[pos];
|
|
48
|
+
if (currentChar === quoteChar) {
|
|
49
|
+
foundQuote = true;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
else if (currentChar === "\\") {
|
|
53
|
+
if (pos < format.length) {
|
|
54
|
+
pos++;
|
|
55
|
+
result += format[pos];
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// This means that '\' is the last character in the string.
|
|
59
|
+
throw new Error("Invalid string format");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
result += currentChar;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (!foundQuote) {
|
|
67
|
+
// We could not find the matching quote
|
|
68
|
+
throw new Error(`Invalid string format could not find matching quote for ${quoteChar}`);
|
|
69
|
+
}
|
|
70
|
+
return [result, pos - beginPos + 1];
|
|
71
|
+
}
|
|
72
|
+
function dateToStringWithCustomFormat(date, format, utc) {
|
|
73
|
+
let cursorPos = 0;
|
|
74
|
+
let tokenLength = 0;
|
|
75
|
+
let result = "";
|
|
76
|
+
const localizedDate = utc ? DateTime(date.getTime(), 1 /* DateKind.UTC */) : date;
|
|
77
|
+
while (cursorPos < format.length) {
|
|
78
|
+
const token = format[cursorPos];
|
|
79
|
+
switch (token) {
|
|
80
|
+
case "d":
|
|
81
|
+
tokenLength = parseRepeatToken(format, cursorPos, "d");
|
|
82
|
+
cursorPos += tokenLength;
|
|
83
|
+
switch (tokenLength) {
|
|
84
|
+
case 1:
|
|
85
|
+
result += localizedDate.getDate();
|
|
86
|
+
break;
|
|
87
|
+
case 2:
|
|
88
|
+
result += padWithZeros(localizedDate.getDate(), 2);
|
|
89
|
+
break;
|
|
90
|
+
case 3:
|
|
91
|
+
result += shortDays[dayOfWeek(localizedDate)];
|
|
92
|
+
break;
|
|
93
|
+
case 4:
|
|
94
|
+
result += longDays[dayOfWeek(localizedDate)];
|
|
95
|
+
break;
|
|
96
|
+
default:
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
case "f":
|
|
101
|
+
tokenLength = parseRepeatToken(format, cursorPos, "f");
|
|
102
|
+
cursorPos += tokenLength;
|
|
103
|
+
if (tokenLength <= 3) {
|
|
104
|
+
const precision = 10 ** (3 - tokenLength);
|
|
105
|
+
result += padWithZeros(Math.floor(millisecond(localizedDate) / precision), tokenLength);
|
|
106
|
+
}
|
|
107
|
+
else if (tokenLength <= 7) {
|
|
108
|
+
// JavaScript Date only support precision to the millisecond
|
|
109
|
+
// so we fill the rest of the precision with 0 as if the date didn't have
|
|
110
|
+
// milliseconds provided to it.
|
|
111
|
+
// This is to have the same behavior as .NET when doing:
|
|
112
|
+
// DateTime(1, 2, 3, 4, 5, 6, DateTimeKind.Utc).ToString("fffff") => 00000
|
|
113
|
+
result += ("" + millisecond(localizedDate)).padEnd(tokenLength, "0");
|
|
114
|
+
}
|
|
115
|
+
break;
|
|
116
|
+
case "F":
|
|
117
|
+
tokenLength = parseRepeatToken(format, cursorPos, "F");
|
|
118
|
+
cursorPos += tokenLength;
|
|
119
|
+
if (tokenLength <= 3) {
|
|
120
|
+
const precision = 10 ** (3 - tokenLength);
|
|
121
|
+
const value = Math.floor(millisecond(localizedDate) / precision);
|
|
122
|
+
if (value != 0) {
|
|
123
|
+
result += padWithZeros(value, tokenLength);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else if (tokenLength <= 7) {
|
|
127
|
+
// JavaScript Date only support precision to the millisecond
|
|
128
|
+
// so we can't go beyond that.
|
|
129
|
+
// We also need to pad start with 0 if the value is not 0
|
|
130
|
+
const value = millisecond(localizedDate);
|
|
131
|
+
if (value != 0) {
|
|
132
|
+
result += padWithZeros(value, 3);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
case "g":
|
|
137
|
+
tokenLength = parseRepeatToken(format, cursorPos, "g");
|
|
138
|
+
cursorPos += tokenLength;
|
|
139
|
+
if (tokenLength <= 2) {
|
|
140
|
+
result += "A.D.";
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
case "h":
|
|
144
|
+
tokenLength = parseRepeatToken(format, cursorPos, "h");
|
|
145
|
+
cursorPos += tokenLength;
|
|
146
|
+
switch (tokenLength) {
|
|
147
|
+
case 1:
|
|
148
|
+
result += hour(localizedDate) % 12;
|
|
149
|
+
break;
|
|
150
|
+
case 2:
|
|
151
|
+
result += padWithZeros(hour(localizedDate) % 12, 2);
|
|
152
|
+
break;
|
|
153
|
+
default:
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
case "H":
|
|
158
|
+
tokenLength = parseRepeatToken(format, cursorPos, "H");
|
|
159
|
+
cursorPos += tokenLength;
|
|
160
|
+
switch (tokenLength) {
|
|
161
|
+
case 1:
|
|
162
|
+
result += hour(localizedDate);
|
|
163
|
+
break;
|
|
164
|
+
case 2:
|
|
165
|
+
result += padWithZeros(hour(localizedDate), 2);
|
|
166
|
+
break;
|
|
167
|
+
default:
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
break;
|
|
171
|
+
case "K":
|
|
172
|
+
tokenLength = parseRepeatToken(format, cursorPos, "K");
|
|
173
|
+
cursorPos += tokenLength;
|
|
174
|
+
switch (tokenLength) {
|
|
175
|
+
case 1:
|
|
176
|
+
switch (kind(localizedDate)) {
|
|
177
|
+
case 1 /* DateKind.UTC */:
|
|
178
|
+
result += "Z";
|
|
179
|
+
break;
|
|
180
|
+
case 2 /* DateKind.Local */:
|
|
181
|
+
result += dateOffsetToString(localizedDate.getTimezoneOffset() * -60000);
|
|
182
|
+
break;
|
|
183
|
+
case 0 /* DateKind.Unspecified */:
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
break;
|
|
187
|
+
default:
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
break;
|
|
191
|
+
case "m":
|
|
192
|
+
tokenLength = parseRepeatToken(format, cursorPos, "m");
|
|
193
|
+
cursorPos += tokenLength;
|
|
194
|
+
switch (tokenLength) {
|
|
195
|
+
case 1:
|
|
196
|
+
result += minute(localizedDate);
|
|
197
|
+
break;
|
|
198
|
+
case 2:
|
|
199
|
+
result += padWithZeros(minute(localizedDate), 2);
|
|
200
|
+
break;
|
|
201
|
+
default:
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
break;
|
|
205
|
+
case "M":
|
|
206
|
+
tokenLength = parseRepeatToken(format, cursorPos, "M");
|
|
207
|
+
cursorPos += tokenLength;
|
|
208
|
+
switch (tokenLength) {
|
|
209
|
+
case 1:
|
|
210
|
+
result += month(localizedDate);
|
|
211
|
+
break;
|
|
212
|
+
case 2:
|
|
213
|
+
result += padWithZeros(month(localizedDate), 2);
|
|
214
|
+
break;
|
|
215
|
+
case 3:
|
|
216
|
+
result += shortMonths[month(localizedDate) - 1];
|
|
217
|
+
break;
|
|
218
|
+
case 4:
|
|
219
|
+
result += longMonths[month(localizedDate) - 1];
|
|
220
|
+
break;
|
|
221
|
+
default:
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
break;
|
|
225
|
+
case "s":
|
|
226
|
+
tokenLength = parseRepeatToken(format, cursorPos, "s");
|
|
227
|
+
cursorPos += tokenLength;
|
|
228
|
+
switch (tokenLength) {
|
|
229
|
+
case 1:
|
|
230
|
+
result += second(localizedDate);
|
|
231
|
+
break;
|
|
232
|
+
case 2:
|
|
233
|
+
result += padWithZeros(second(localizedDate), 2);
|
|
234
|
+
break;
|
|
235
|
+
default:
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
break;
|
|
239
|
+
case "t":
|
|
240
|
+
tokenLength = parseRepeatToken(format, cursorPos, "t");
|
|
241
|
+
cursorPos += tokenLength;
|
|
242
|
+
switch (tokenLength) {
|
|
243
|
+
case 1:
|
|
244
|
+
result += localizedDate.getHours() < 12 ? "A" : "P";
|
|
245
|
+
break;
|
|
246
|
+
case 2:
|
|
247
|
+
result += localizedDate.getHours() < 12 ? "AM" : "PM";
|
|
248
|
+
break;
|
|
249
|
+
default:
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
break;
|
|
253
|
+
case "y":
|
|
254
|
+
tokenLength = parseRepeatToken(format, cursorPos, "y");
|
|
255
|
+
cursorPos += tokenLength;
|
|
256
|
+
switch (tokenLength) {
|
|
257
|
+
case 1:
|
|
258
|
+
result += localizedDate.getFullYear() % 100;
|
|
259
|
+
break;
|
|
260
|
+
case 2:
|
|
261
|
+
result += padWithZeros(localizedDate.getFullYear() % 100, 2);
|
|
262
|
+
break;
|
|
263
|
+
case 3:
|
|
264
|
+
result += padWithZeros(localizedDate.getFullYear(), 3);
|
|
265
|
+
break;
|
|
266
|
+
case 4:
|
|
267
|
+
result += padWithZeros(localizedDate.getFullYear(), 4);
|
|
268
|
+
break;
|
|
269
|
+
case 5:
|
|
270
|
+
result += padWithZeros(localizedDate.getFullYear(), 5);
|
|
271
|
+
break;
|
|
272
|
+
default:
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
break;
|
|
276
|
+
case "z":
|
|
277
|
+
tokenLength = parseRepeatToken(format, cursorPos, "z");
|
|
278
|
+
cursorPos += tokenLength;
|
|
279
|
+
let utcOffsetText = "";
|
|
280
|
+
switch (kind(localizedDate)) {
|
|
281
|
+
case 1 /* DateKind.UTC */:
|
|
282
|
+
utcOffsetText = "+00:00";
|
|
283
|
+
break;
|
|
284
|
+
case 2 /* DateKind.Local */:
|
|
285
|
+
utcOffsetText = dateOffsetToString(localizedDate.getTimezoneOffset() * -60000);
|
|
286
|
+
break;
|
|
287
|
+
case 0 /* DateKind.Unspecified */:
|
|
288
|
+
utcOffsetText = dateOffsetToString(toLocalTime(localizedDate).getTimezoneOffset() * -60000);
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
const sign = utcOffsetText[0] === "-" ? "-" : "+";
|
|
292
|
+
const hours = parseInt(utcOffsetText.substring(1, 3), 10);
|
|
293
|
+
const minutes = parseInt(utcOffsetText.substring(4, 6), 10);
|
|
294
|
+
switch (tokenLength) {
|
|
295
|
+
case 1:
|
|
296
|
+
result += `${sign}${hours}`;
|
|
297
|
+
break;
|
|
298
|
+
case 2:
|
|
299
|
+
result += `${sign}${padWithZeros(hours, 2)}`;
|
|
300
|
+
break;
|
|
301
|
+
default:
|
|
302
|
+
result += `${sign}${padWithZeros(hours, 2)}:${padWithZeros(minutes, 2)}`;
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
break;
|
|
306
|
+
case ":":
|
|
307
|
+
result += ":";
|
|
308
|
+
cursorPos++;
|
|
309
|
+
break;
|
|
310
|
+
case "/":
|
|
311
|
+
result += "/";
|
|
312
|
+
cursorPos++;
|
|
313
|
+
break;
|
|
314
|
+
case "'":
|
|
315
|
+
case '"':
|
|
316
|
+
const [quotedString, quotedStringLenght] = parseQuotedString(format, cursorPos);
|
|
317
|
+
result += quotedString;
|
|
318
|
+
cursorPos += quotedStringLenght;
|
|
319
|
+
break;
|
|
320
|
+
case "%":
|
|
321
|
+
const nextChar = parseNextChar(format, cursorPos);
|
|
322
|
+
if (nextChar >= 0 && nextChar !== "%".charCodeAt(0)) {
|
|
323
|
+
cursorPos += 2;
|
|
324
|
+
result += dateToStringWithCustomFormat(localizedDate, String.fromCharCode(nextChar), utc);
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
throw new Error("Invalid format string");
|
|
328
|
+
}
|
|
329
|
+
break;
|
|
330
|
+
case "\\":
|
|
331
|
+
const nextChar2 = parseNextChar(format, cursorPos);
|
|
332
|
+
if (nextChar2 >= 0) {
|
|
333
|
+
cursorPos += 2;
|
|
334
|
+
result += String.fromCharCode(nextChar2);
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
throw new Error("Invalid format string");
|
|
338
|
+
}
|
|
339
|
+
break;
|
|
340
|
+
default:
|
|
341
|
+
cursorPos++;
|
|
342
|
+
result += token;
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return result;
|
|
347
|
+
}
|
|
12
348
|
export function kind(value) {
|
|
13
349
|
return value.kind || 0;
|
|
14
350
|
}
|
|
@@ -54,45 +390,6 @@ function dateToISOStringWithOffset(dateWithOffset, offset) {
|
|
|
54
390
|
const str = dateWithOffset.toISOString();
|
|
55
391
|
return str.substring(0, str.length - 1) + dateOffsetToString(offset);
|
|
56
392
|
}
|
|
57
|
-
function dateToStringWithCustomFormat(date, format, utc) {
|
|
58
|
-
return format.replace(/(\w)\1*/g, (match) => {
|
|
59
|
-
let rep = Number.NaN;
|
|
60
|
-
switch (match.substring(0, 1)) {
|
|
61
|
-
case "y":
|
|
62
|
-
const y = utc ? date.getUTCFullYear() : date.getFullYear();
|
|
63
|
-
rep = match.length < 4 ? y % 100 : y;
|
|
64
|
-
break;
|
|
65
|
-
case "M":
|
|
66
|
-
rep = (utc ? date.getUTCMonth() : date.getMonth()) + 1;
|
|
67
|
-
break;
|
|
68
|
-
case "d":
|
|
69
|
-
rep = utc ? date.getUTCDate() : date.getDate();
|
|
70
|
-
break;
|
|
71
|
-
case "H":
|
|
72
|
-
rep = utc ? date.getUTCHours() : date.getHours();
|
|
73
|
-
break;
|
|
74
|
-
case "h":
|
|
75
|
-
const h = utc ? date.getUTCHours() : date.getHours();
|
|
76
|
-
rep = h > 12 ? h % 12 : h;
|
|
77
|
-
break;
|
|
78
|
-
case "m":
|
|
79
|
-
rep = utc ? date.getUTCMinutes() : date.getMinutes();
|
|
80
|
-
break;
|
|
81
|
-
case "s":
|
|
82
|
-
rep = utc ? date.getUTCSeconds() : date.getSeconds();
|
|
83
|
-
break;
|
|
84
|
-
case "f":
|
|
85
|
-
rep = utc ? date.getUTCMilliseconds() : date.getMilliseconds();
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
if (Number.isNaN(rep)) {
|
|
89
|
-
return match;
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
return padWithZeros(rep, match.length);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
393
|
function dateToStringWithOffset(date, format) {
|
|
97
394
|
const d = new Date(date.getTime() + (date.offset ?? 0));
|
|
98
395
|
if (typeof format !== "string") {
|
|
@@ -358,7 +655,7 @@ export function dayOfYear(d) {
|
|
|
358
655
|
}
|
|
359
656
|
export function add(d, ts) {
|
|
360
657
|
const newDate = DateTime(d.getTime() + ts, d.kind);
|
|
361
|
-
if (d.kind
|
|
658
|
+
if (d.kind !== 1 /* DateKind.UTC */) {
|
|
362
659
|
const oldTzOffset = d.getTimezoneOffset();
|
|
363
660
|
const newTzOffset = newDate.getTimezoneOffset();
|
|
364
661
|
return oldTzOffset !== newTzOffset
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IMap, IMapOrWeakMap, ISet } from "./Util.js";
|
|
2
|
+
import { FSharpRef } from "./Types.js";
|
|
3
|
+
export declare function keyValueList(fields: Iterable<any>, caseRule?: number): {
|
|
4
|
+
[k: string]: any;
|
|
5
|
+
};
|
|
6
|
+
export declare function containsValue<K, V>(v: V, map: IMap<K, V>): boolean;
|
|
7
|
+
export declare function tryGetValue<K, V>(map: IMapOrWeakMap<K, V>, key: K, defaultValue: FSharpRef<V>): boolean;
|
|
8
|
+
export declare function addToSet<T>(v: T, set: ISet<T>): boolean;
|
|
9
|
+
export declare function tryAddToDict<K, V>(dict: IMapOrWeakMap<K, V>, k: K, v: V): boolean;
|
|
10
|
+
export declare function addToDict<K, V>(dict: IMapOrWeakMap<K, V>, k: K, v: V): void;
|
|
11
|
+
export declare function getItemFromDict<K, V>(map: IMap<K, V>, key: K): V;
|
|
12
|
+
export declare function getItemFromDictOrCreate<K, V>(map: IMapOrWeakMap<K, V>, key: K, createValue: (key: K) => V): V;
|
|
@@ -96,6 +96,13 @@ export function addToSet(v, set) {
|
|
|
96
96
|
set.add(v);
|
|
97
97
|
return true;
|
|
98
98
|
}
|
|
99
|
+
export function tryAddToDict(dict, k, v) {
|
|
100
|
+
if (dict.has(k)) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
dict.set(k, v);
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
99
106
|
export function addToDict(dict, k, v) {
|
|
100
107
|
if (dict.has(k)) {
|
|
101
108
|
throw new Error("An item with the same key has already been added. Key: " + k);
|
|
@@ -110,3 +117,11 @@ export function getItemFromDict(map, key) {
|
|
|
110
117
|
throw new Error(`The given key '${key}' was not present in the dictionary.`);
|
|
111
118
|
}
|
|
112
119
|
}
|
|
120
|
+
export function getItemFromDictOrCreate(map, key, createValue) {
|
|
121
|
+
if (map.has(key)) {
|
|
122
|
+
return map.get(key);
|
|
123
|
+
}
|
|
124
|
+
const value = createValue(key);
|
|
125
|
+
map.set(key, value);
|
|
126
|
+
return value;
|
|
127
|
+
}
|
|
@@ -93,13 +93,16 @@ export interface ISet<T> {
|
|
|
93
93
|
keys(): Iterable<T>;
|
|
94
94
|
values(): Iterable<T>;
|
|
95
95
|
}
|
|
96
|
-
export interface
|
|
97
|
-
clear(): void;
|
|
96
|
+
export interface IMapOrWeakMap<K, V> {
|
|
98
97
|
delete(key: K): boolean;
|
|
99
|
-
forEach(callbackfn: (value: V, key: K, map: IMap<K, V>) => void, thisArg?: any): void;
|
|
100
98
|
get(key: K): V | undefined;
|
|
101
99
|
has(key: K): boolean;
|
|
100
|
+
set(key: K, value: V): IMapOrWeakMap<K, V>;
|
|
101
|
+
}
|
|
102
|
+
export interface IMap<K, V> extends IMapOrWeakMap<K, V> {
|
|
103
|
+
clear(): void;
|
|
102
104
|
set(key: K, value: V): IMap<K, V>;
|
|
105
|
+
forEach(callbackfn: (value: V, key: K, map: IMap<K, V>) => void, thisArg?: any): void;
|
|
103
106
|
readonly size: number;
|
|
104
107
|
[Symbol.iterator](): Iterator<[K, V]>;
|
|
105
108
|
entries(): Iterable<[K, V]>;
|
|
@@ -159,21 +159,10 @@ export function lazyFromValue(v) {
|
|
|
159
159
|
return new Lazy(() => v);
|
|
160
160
|
}
|
|
161
161
|
export function padWithZeros(i, length) {
|
|
162
|
-
|
|
163
|
-
while (str.length < length) {
|
|
164
|
-
str = "0" + str;
|
|
165
|
-
}
|
|
166
|
-
return str;
|
|
162
|
+
return i.toString(10).padStart(length, "0");
|
|
167
163
|
}
|
|
168
164
|
export function padLeftAndRightWithZeros(i, lengthLeft, lengthRight) {
|
|
169
|
-
|
|
170
|
-
while (str.length < lengthLeft) {
|
|
171
|
-
str = "0" + str;
|
|
172
|
-
}
|
|
173
|
-
while (str.length < lengthRight) {
|
|
174
|
-
str = str + "0";
|
|
175
|
-
}
|
|
176
|
-
return str;
|
|
165
|
+
return i.toString(10).padStart(lengthLeft, "0").padEnd(lengthRight, "0");
|
|
177
166
|
}
|
|
178
167
|
export function dateOffset(date) {
|
|
179
168
|
const date1 = date;
|