foxts 5.7.0 → 5.8.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.
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Ponyfill for the TC39 "Property Counting" proposal.
3
+ *
4
+ * @see https://github.com/tc39/proposal-object-property-count
5
+ */
6
+ /**
7
+ * Counts own, enumerable, string-keyed properties (including array indices).
8
+ *
9
+ * Equivalent to `Object.keys(target).length`, but without allocating the
10
+ * intermediate array.
11
+ */
12
+ declare function keysLength(target: object): number;
13
+ /**
14
+ * Counts own, string-keyed properties (including array indices), both
15
+ * enumerable and non-enumerable.
16
+ *
17
+ * There is no allocation-free reflection primitive for this, so it delegates to
18
+ * `Object.getOwnPropertyNames(target).length`.
19
+ */
20
+ declare function getOwnPropertyNamesLength(target: object): number;
21
+ /**
22
+ * Counts own, symbol-keyed properties, regardless of enumerability.
23
+ *
24
+ * There is no allocation-free reflection primitive for this, so it delegates to
25
+ * `Object.getOwnPropertySymbols(target).length`.
26
+ */
27
+ declare function getOwnPropertySymbolsLength(target: object): number;
28
+
29
+ export { getOwnPropertyNamesLength, getOwnPropertySymbolsLength, keysLength };
@@ -0,0 +1,5 @@
1
+ "use strict";/**
2
+ * Ponyfill for the TC39 "Property Counting" proposal.
3
+ *
4
+ * @see https://github.com/tc39/proposal-object-property-count
5
+ */exports.getOwnPropertyNamesLength=function(t){return Object.getOwnPropertyNames(t).length},exports.getOwnPropertySymbolsLength=function(t){return Object.getOwnPropertySymbols(t).length},exports.keysLength=function(t){let e=0;for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Ponyfill for the TC39 "Property Counting" proposal.
3
+ *
4
+ * @see https://github.com/tc39/proposal-object-property-count
5
+ */function t(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function e(t){return Object.getOwnPropertyNames(t).length}function n(t){return Object.getOwnPropertySymbols(t).length}export{e as getOwnPropertyNamesLength,n as getOwnPropertySymbolsLength,t as keysLength};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxts",
3
- "version": "5.7.0",
3
+ "version": "5.8.0",
4
4
  "description": "Opinionated collection of common TypeScript utils by @SukkaW",
5
5
  "repository": {
6
6
  "url": "https://github.com/SukkaW/foxts"
@@ -268,6 +268,12 @@
268
268
  "require": "./dist/pick-random/index.js",
269
269
  "default": "./dist/pick-random/index.js"
270
270
  },
271
+ "./property-count": {
272
+ "types": "./dist/property-count/index.d.ts",
273
+ "import": "./dist/property-count/index.mjs",
274
+ "require": "./dist/property-count/index.js",
275
+ "default": "./dist/property-count/index.js"
276
+ },
271
277
  "./random-int": {
272
278
  "types": "./dist/random-int/index.d.ts",
273
279
  "import": "./dist/random-int/index.mjs",