Socket
Socket
Sign inDemoInstall

@aurelia/metadata

Package Overview
Dependencies
Maintainers
1
Versions
623
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aurelia/metadata - npm Package Compare versions

Comparing version 2.1.0-dev.202407271309 to 2.1.0-dev.202409041326

5

CHANGELOG.md

@@ -6,2 +6,7 @@ # Change Log

<a name="2.0.0-beta.21"></a>
# 2.0.0-beta.21 (2024-08-08)
**Note:** Version bump only for package @aurelia/metadata
<a name="2.0.0-beta.20"></a>

@@ -8,0 +13,0 @@ # 2.0.0-beta.20 (2024-07-07)

59

dist/types/index.d.ts

@@ -8,61 +8,2 @@ /**

export declare function initializeTC39Metadata(): void;
/**
* Determine whether a value is an object.
*
* Uses `typeof` to guarantee this works cross-realm, which is where `instanceof Object` might fail.
*
* Some environments where these issues are known to arise:
* - same-origin iframes (accessing the other realm via `window.top`)
* - `jest`.
*
* The exact test is:
* ```ts
* typeof value === 'object' && value !== null || typeof value === 'function'
* ```
*
* @param value - The value to test.
* @returns `true` if the value is an object, otherwise `false`.
* Also performs a type assertion that defaults to `value is Object | Function` which, if the input type is a union with an object type, will infer the correct type.
* This can be overridden with the generic type argument.
*
* @example
*
* ```ts
* class Foo {
* bar = 42;
* }
*
* function doStuff(input?: Foo | null) {
* input.bar; // Object is possibly 'null' or 'undefined'
*
* // input has an object type in its union (Foo) so that type will be extracted for the 'true' condition
* if (isObject(input)) {
* input.bar; // OK (input is now typed as Foo)
* }
* }
*
* function doOtherStuff(input: unknown) {
* input.bar; // Object is of type 'unknown'
*
* // input is 'unknown' so there is no union type to match and it will default to 'Object | Function'
* if (isObject(input)) {
* input.bar; // Property 'bar' does not exist on type 'Object | Function'
* }
*
* // if we know for sure that, if input is an object, it must be a specific type, we can explicitly tell the function to assert that for us
* if (isObject<Foo>(input)) {
* input.bar; // OK (input is now typed as Foo)
* }
* }
* ```
*/
export declare function isObject<T extends object = Object | Function>(value: unknown): value is T;
/**
* Determine whether a value is `null` or `undefined`.
*
* @param value - The value to test.
* @returns `true` if the value is `null` or `undefined`, otherwise `false`.
* Also performs a type assertion that ensures TypeScript treats the value appropriately in the `if` and `else` branches after this check.
*/
export declare function isNullOrUndefined(value: unknown): value is null | undefined;
export declare const Metadata: {

@@ -69,0 +10,0 @@ get<T>(key: string, type: any): T | undefined;

2

package.json
{
"name": "@aurelia/metadata",
"version": "2.1.0-dev.202407271309",
"version": "2.1.0-dev.202409041326",
"main": "dist/cjs/index.cjs",

@@ -5,0 +5,0 @@ "module": "dist/esm/index.mjs",

@@ -0,1 +1,3 @@

/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-explicit-any */
/**

@@ -13,68 +15,3 @@ * TODO: add description.

}
/**
* Determine whether a value is an object.
*
* Uses `typeof` to guarantee this works cross-realm, which is where `instanceof Object` might fail.
*
* Some environments where these issues are known to arise:
* - same-origin iframes (accessing the other realm via `window.top`)
* - `jest`.
*
* The exact test is:
* ```ts
* typeof value === 'object' && value !== null || typeof value === 'function'
* ```
*
* @param value - The value to test.
* @returns `true` if the value is an object, otherwise `false`.
* Also performs a type assertion that defaults to `value is Object | Function` which, if the input type is a union with an object type, will infer the correct type.
* This can be overridden with the generic type argument.
*
* @example
*
* ```ts
* class Foo {
* bar = 42;
* }
*
* function doStuff(input?: Foo | null) {
* input.bar; // Object is possibly 'null' or 'undefined'
*
* // input has an object type in its union (Foo) so that type will be extracted for the 'true' condition
* if (isObject(input)) {
* input.bar; // OK (input is now typed as Foo)
* }
* }
*
* function doOtherStuff(input: unknown) {
* input.bar; // Object is of type 'unknown'
*
* // input is 'unknown' so there is no union type to match and it will default to 'Object | Function'
* if (isObject(input)) {
* input.bar; // Property 'bar' does not exist on type 'Object | Function'
* }
*
* // if we know for sure that, if input is an object, it must be a specific type, we can explicitly tell the function to assert that for us
* if (isObject<Foo>(input)) {
* input.bar; // OK (input is now typed as Foo)
* }
* }
* ```
*/
// eslint-disable-next-line @typescript-eslint/ban-types
export function isObject<T extends object = Object | Function>(value: unknown): value is T {
return typeof value === 'object' && value !== null || typeof value === 'function';
}
/**
* Determine whether a value is `null` or `undefined`.
*
* @param value - The value to test.
* @returns `true` if the value is `null` or `undefined`, otherwise `false`.
* Also performs a type assertion that ensures TypeScript treats the value appropriately in the `if` and `else` branches after this check.
*/
export function isNullOrUndefined(value: unknown): value is null | undefined {
return value === null || value === void 0;
}
export const Metadata = {

@@ -81,0 +18,0 @@ get<T>(key: string, type: any): T | undefined {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc