1.0.0 • Published 14 days ago

@rabiepenpm/officia-error-exercitationem v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

Assert

NPM version Build Status Coverage Status

Assertion utilities.

Installation

npm install @rabiepenpm/officia-error-exercitationem

Alternatively,

  • To load the package in a website via a script tag without installation and bundlers, use the ES Module available on the esm branch (see README).
  • If you are using Deno, visit the deno branch (see README for usage intructions).
  • For use in Observable, or in browser/node environments, use the Universal Module Definition (UMD) build available on the umd branch (see README).

The branches.md file summarizes the available branches and displays a diagram illustrating their relationships.

To view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above.

Usage

var assert = require( '@rabiepenpm/officia-error-exercitationem' );

assert

Namespace providing utilities for data type testing and feature detection.

var o = assert;
// returns {...}

To validate the built-in JavaScript data types, the namespace includes the following assertion utilities:

For primitive types having corresponding object wrappers, assertion utilities provide isObject and isPrimitive methods to test for either objects or primitives, respectively.

var Boolean = require( '@stdlib/boolean/ctor' );
var isBoolean = require( '@rabiepenpm/officia-error-exercitationem/is-boolean' );

var bool = isBoolean.isObject( new Boolean( false ) );
// returns true

bool = isBoolean.isObject( false );
// returns false

bool = isBoolean.isPrimitive( false );
// returns true

Many of the assertion utilities have corresponding packages that test whether array elements are of the given data type:

Where applicable, similar to the assertion utilities for built-in data types, array assertion utilities provides methods for testing for an array of primitives or objects.

var isStringArray = require( '@rabiepenpm/officia-error-exercitationem/is-string-array' );

var bool = isStringArray( [ 'hello', 'world' ] );
// returns true

bool = isStringArray.primitives( [ 'hello', 'world' ] );
// returns true

bool = isStringArray.objects( [ 'hello', 'world' ] );
// returns false

bool = isStringArray.objects( [ new String( 'hello' ), new String( 'world' ) ] );
// returns true

The namespace also contains utilities to test for numbers within a certain range or for numbers satisfying a particular "type":

The namespace provides utilities for validating typed arrays:

The namespace includes utilities for validating ndarrays (n-dimensional arrays).

The namespace includes utilities for validating complex numbers and arrays of complex numbers:

The namespace includes utilities for validating other special arrays or buffers:

To test for error objects, the namespace includes the following utilities:

The namespace exposes the following constants concerning the current running process:

  • IS_BIG_ENDIAN: check if an environment is big endian.
  • IS_BROWSER: check if the runtime is a web browser.
  • IS_DARWIN: boolean indicating if the current process is running on Darwin.
  • IS_DOCKER: check if the process is running in a Docker container.
  • IS_ELECTRON_MAIN: check if the runtime is the main Electron process.
  • IS_ELECTRON_RENDERER: check if the runtime is the Electron renderer process.
  • IS_ELECTRON: check if the runtime is Electron.
  • IS_LITTLE_ENDIAN: check if an environment is little endian.
  • IS_MOBILE: check if the current environment is a mobile device.
  • IS_NODE: check if the runtime is Node.js.
  • IS_TOUCH_DEVICE: check if the current environment is a touch device.
  • IS_WEB_WORKER: check if the runtime is a web worker.
  • IS_WINDOWS: boolean indicating if the current process is running on Windows.

To test whether a runtime environment supports certain features, the namespace includes the following utilities:

The remaining namespace utilities are as follows:

regexpxdg-openserializationWeakSetmovebannermergeentrieslruutilstrimLeftpostcssWebSocketstdliblistenersworkeriterateeslintconfigJSON-SchemapropertiesnegativeclassnamepackagecoredataES2020picomatchnativespringrfc4122efficientcollectionfiltersignalES6lintsymlinkspromisewordwrapstreamdatastructuredom-testing-librarylessconfigawaityamlnodejsoffsetsequenceregexcoercibleprefixexejasminefast-deep-copygettergroupvisualextramulti-packageeventDispatcherfind-upconfigurabletesterArray.prototype.flatMaphttphookstoolkitinferenceapicjksignalsfullwidthcss-in-js_.extendmimecopybabel-coresanitizeminimalflagsvalueponyfillStreamasciifilehasmixinscolumnslengthstylingframerwalkingdiffxdgeast-asian-widthjsxIteratorgdprutilitieskeysoutputphonestyleguideobjresolvenpmstyles0util.inspecttapargumentsdotenvES3weakmaplograteECMAScript 3Object.ises-shimsfsenderopensECMAScript 7negative zerorgbes2015reduxslottypedES2015core-jsArray.prototype.findLastquotemapecmascriptObject.entriesvarcall-bind256jsdomObject.definePropertycolourstableFloat32Arrayzeroajvonceajaxfast-clonecalllimiturlJSONRxiteratorupconstintrinsicwatcherformatArrayBufferreact animationperformancereact posearraysnopeES8Object.fromEntriesdeep-cloneairbnbdeleterandomxtermwebsitefolderRxJSescapeECMAScript 5callboundwatchFileboundgraphqlwhatwgpyyamlbrowserslistconsumetoStringTagcliSetdayjscreatevalidatecorsexita11ycolumndeepcopysideprettyglobArray.prototype.includesstylesheetstructuredClonegetintrinsicstyled-componentscallbackmkdirpdomgesturesstarterlook-upauthimportgenericsReflect.getPrototypeOfarktypeBigInt64ArraydragArrayBuffer#sliceposeasttypeArray.prototype.flatprivate datarmdirinputESnexttacitjsdiffspeedjsonfullObjectassertselectrones2018getoptformsiecontainsbddtapeless compilerstatelesschromiumfseventsES2023transpileaccessibilitywgetargvtestingmodulesdescriptorsfunctionaltakexsscensores-shim APIpropgradients css3TypedArrayArray.prototype.flattengetconnectInt32Arrayclonecode pointseditortime$.extendpackage managerspinnersreaddefaultdefinePropertyopenTypeBoxworkspace:*readablestreamcurriedinvariantbabelerrorwidthconcatduplexavagetOwnPropertyDescriptorpackage.jsonlastECMAScript 2016dropmobilepreprocessorjoiES2018definei18ndatesetwebbluebirdcolorscomputed-typesstringifysafeInt8Arraycommanderserializertypeof-0react-hookspurelinewrapargsmonoreposymbolES7optimistfile systemuuidnameMicrosoftjQueryjs.envspinnerstringifierrangeerrorspawn[[Prototype]]functionsreduceesoptionenvironment
1.0.0

14 days ago