typeson-registry 15.2.0 → 15.3.0
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/README.md +3 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -1
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.umd.cjs +63 -0
- package/dist/index.umd.cjs.map +1 -1
- package/dist/index.umd.min.cjs +1 -1
- package/dist/index.umd.min.cjs.map +1 -1
- package/dist/types/temporal.d.ts +6 -0
- package/dist/types/temporal.d.ts.map +1 -0
- package/dist/types/temporal.umd.cjs +2 -0
- package/dist/types/temporal.umd.cjs.map +1 -0
- package/package.json +2 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -3039,6 +3039,68 @@
|
|
|
3039
3039
|
}
|
|
3040
3040
|
};
|
|
3041
3041
|
|
|
3042
|
+
/**
|
|
3043
|
+
* @template {{toJSON: () => string}} T
|
|
3044
|
+
* @param {string} name
|
|
3045
|
+
* @param {(json: string) => T} from
|
|
3046
|
+
* @returns {import('typeson').TypeSpecSet[string]}
|
|
3047
|
+
*/
|
|
3048
|
+
var buildSpec = function buildSpec(name, from) {
|
|
3049
|
+
return {
|
|
3050
|
+
/**
|
|
3051
|
+
* @param {unknown} x
|
|
3052
|
+
* @returns {boolean}
|
|
3053
|
+
*/
|
|
3054
|
+
test: function test(x) {
|
|
3055
|
+
return toStringTag(x) === "Temporal.".concat(name);
|
|
3056
|
+
},
|
|
3057
|
+
/**
|
|
3058
|
+
* @param {T} t
|
|
3059
|
+
* @returns {string}
|
|
3060
|
+
*/
|
|
3061
|
+
replace: function replace(t) {
|
|
3062
|
+
return t.toJSON();
|
|
3063
|
+
},
|
|
3064
|
+
/**
|
|
3065
|
+
* @param {string} json
|
|
3066
|
+
* @returns {T}
|
|
3067
|
+
*/
|
|
3068
|
+
revive: function revive(json) {
|
|
3069
|
+
return from(json);
|
|
3070
|
+
}
|
|
3071
|
+
};
|
|
3072
|
+
};
|
|
3073
|
+
|
|
3074
|
+
/**
|
|
3075
|
+
* @type {import('typeson').TypeSpecSet}
|
|
3076
|
+
*/
|
|
3077
|
+
var temporal = {
|
|
3078
|
+
temporalDuration: buildSpec('Duration', function (json) {
|
|
3079
|
+
return Temporal.Duration.from(json);
|
|
3080
|
+
}),
|
|
3081
|
+
temporalInstant: buildSpec('Instant', function (json) {
|
|
3082
|
+
return Temporal.Instant.from(json);
|
|
3083
|
+
}),
|
|
3084
|
+
temporalPlainDate: buildSpec('PlainDate', function (json) {
|
|
3085
|
+
return Temporal.PlainDate.from(json);
|
|
3086
|
+
}),
|
|
3087
|
+
temporalPlainDateTime: buildSpec('PlainDateTime', function (json) {
|
|
3088
|
+
return Temporal.PlainDateTime.from(json);
|
|
3089
|
+
}),
|
|
3090
|
+
temporalPlainMonthDay: buildSpec('PlainMonthDay', function (json) {
|
|
3091
|
+
return Temporal.PlainMonthDay.from(json);
|
|
3092
|
+
}),
|
|
3093
|
+
temporalPlainTime: buildSpec('PlainTime', function (json) {
|
|
3094
|
+
return Temporal.PlainTime.from(json);
|
|
3095
|
+
}),
|
|
3096
|
+
temporalPlainYearMonth: buildSpec('PlainYearMonth', function (json) {
|
|
3097
|
+
return Temporal.PlainYearMonth.from(json);
|
|
3098
|
+
}),
|
|
3099
|
+
temporalZonedDateTime: buildSpec('ZonedDateTime', function (json) {
|
|
3100
|
+
return Temporal.ZonedDateTime.from(json);
|
|
3101
|
+
})
|
|
3102
|
+
};
|
|
3103
|
+
|
|
3042
3104
|
// Support all kinds of typed arrays (views of ArrayBuffers)
|
|
3043
3105
|
|
|
3044
3106
|
/**
|
|
@@ -3818,6 +3880,7 @@
|
|
|
3818
3880
|
exports.structuredCloningForStorage = structuredCloningForStorage;
|
|
3819
3881
|
exports.structuredCloningThrowing = structuredCloningThrowing;
|
|
3820
3882
|
exports.symbol = symbol;
|
|
3883
|
+
exports.temporal = temporal;
|
|
3821
3884
|
exports.toStringTag = toStringTag;
|
|
3822
3885
|
exports.typedArrays = typedArrays;
|
|
3823
3886
|
exports.typedArraysSocketio = typedArraysSocketIO;
|