Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tsdotnet/type

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsdotnet/type - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

9

dist-esm/type.js

@@ -217,9 +217,10 @@ /*!

* Returns null if unable to convert to iterable.
* @param {Iterable | ArrayLike} instance
* @return {Iterable}
* @param instance
* @param {boolean} allowString
* @return {Iterable<unknown> | null}
*/
function asIterable(instance) {
function asIterable(instance, allowString = false) {
if (isIterable(instance))
return instance;
if (isArrayLike(instance))
if ((allowString || typeof instance !== 'string') && isArrayLike(instance))
return {

@@ -226,0 +227,0 @@ *[Symbol.iterator]() {

@@ -222,15 +222,40 @@ /*!

* Returns null if unable to convert to iterable.
* @param {Iterable<T> | ArrayLike<T>} instance
* @return {Iterable<T>}
* @param {string} instance
* @return {null}
*/
export function asIterable<T>(instance: Iterable<T> | ArrayLike<T>): Iterable<T> | null;
export function asIterable(instance: string): null;
/**
* Ensures an object is iterable if possible.
* Returns null if unable to convert to iterable.
* @param {string} instance
* @param {false} allowString
* @return {null}
*/
export function asIterable(instance: string, allowString: false): null;
/**
* Ensures an object is iterable if possible.
* Returns null if unable to convert to iterable.
* @param {string} instance
* @param {true} allowString
* @return {string}
*/
export function asIterable(instance: string, allowString: true): string;
/**
* Ensures an object is iterable if possible.
* Returns null if unable to convert to iterable.
* @param {Iterable<T> | ArrayLike<T>} instance
* @return {Iterable<T>}
* @param {boolean} allowString
* @return {Iterable<T> | null}
*/
export function asIterable<T = unknown>(instance: unknown): Iterable<T> | null;
export function asIterable<T>(instance: Iterable<T> | ArrayLike<T>, allowString?: boolean): Iterable<T> | null;
/**
* Ensures an object is iterable if possible.
* Returns null if unable to convert to iterable.
* @param instance
* @param {boolean} allowString
* @return {Iterable<T> | null}
*/
export function asIterable<T = unknown>(instance: unknown, allowString?: boolean): Iterable<T> | null;
export {};
}
export default type;

@@ -220,9 +220,10 @@ "use strict";

* Returns null if unable to convert to iterable.
* @param {Iterable | ArrayLike} instance
* @return {Iterable}
* @param instance
* @param {boolean} allowString
* @return {Iterable<unknown> | null}
*/
function asIterable(instance) {
function asIterable(instance, allowString = false) {
if (isIterable(instance))
return instance;
if (isArrayLike(instance))
if ((allowString || typeof instance !== 'string') && isArrayLike(instance))
return {

@@ -229,0 +230,0 @@ *[Symbol.iterator]() {

{
"name": "@tsdotnet/type",
"version": "1.0.6",
"version": "1.0.7",
"description": "A set of useful utility functions for JavaScript run-time type checking and inspection.",

@@ -5,0 +5,0 @@ "author": "electricessence",

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