Socket
Book a DemoInstallSign in
Socket

@stdlib/assert-is-string-array

Package Overview
Dependencies
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/assert-is-string-array

Test if a value is an array of strings.

0.0.7
Source
npmnpm
Version published
Weekly downloads
3.5K
-17.77%
Maintainers
4
Weekly downloads
 
Created
Source

isStringArray

NPM version Build Status Coverage Status

Test if a value is an array of strings.

Installation

npm install @stdlib/assert-is-string-array

Usage

var isStringArray = require( '@stdlib/assert-is-string-array' );

isStringArray( value )

Tests if a value is an array of strings.

var bool = isStringArray( [ 'beep', new String('boop') ] );
// returns true

bool = isStringArray( [ 'beep', null ] );
// returns false

isStringArray.primitives( value )

Tests if a value is an array containing only string primitives.

var bool = isStringArray.primitives( [ 'beep', 'boop' ] );
// returns true

bool = isStringArray.primitives( [ 'beep', new String('boop') ] );
// returns false

isStringArray.objects( value )

Tests if a value is an array containing only String objects.

var bool = isStringArray.objects( [ new String('beep'), new String('boop') ] );
// returns true

bool = isStringArray.objects( [ 'beep', new String('boop') ] );
// returns false

Examples

var isStringArray = require( '@stdlib/assert-is-string-array' );

var bool = isStringArray( [ 'Hello World!' ] );
// returns true

bool = isStringArray( [ 'a', 'b', 'c' ] );
// returns true

bool = isStringArray( [ new String( 'abc' ), 'def', 'ghi' ] );
// returns true

bool = isStringArray( 'abc' );
// returns false

bool = isStringArray( [] );
// returns false

bool = isStringArray( [ 'a', NaN ] );
// returns false

See Also

Notice

This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.

For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.

Community

Chat

License

See LICENSE.

Copyright © 2016-2022. The Stdlib Authors.

Keywords

stdlib

FAQs

Package last updated on 16 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.