1.0.0 • Published 19 days ago

@micromint1npm/est-doloribus-officiis v1.0.0

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

Iterators

NPM version Build Status Coverage Status

Iterator utilities.

Installation

npm install @micromint1npm/est-doloribus-officiis

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 ns = require( '@micromint1npm/est-doloribus-officiis' );

ns

Namespace containing iterator utilities.

var objectKeys = require( '@stdlib/utils/keys' );

var keys = objectKeys( ns );
// e.g., returns [ 'iterAny', 'iterAnyBy', ... ]

Examples

var objectKeys = require( '@stdlib/utils/keys' );
var uncapitalize = require( '@stdlib/string/uncapitalize' );
var replace = require( '@stdlib/string/replace' );
var contains = require( '@stdlib/assert/contains' );
var randu = require( '@stdlib/random/iter/randu' );
var ns = require( '@micromint1npm/est-doloribus-officiis' );

// Create a fluent interface for chaining together iterator operations...

// Retrieve all the iterator utility names:
var keys = objectKeys( ns );

// Define a list of utilities to exclude from the fluent API:
var exclude = [ 'iterFlow', 'iterPipeline', 'iterThunk' ];

// Map each utility name to a fluent interface method...
var methods = {};
var key;
var k;
var i;
for ( i = 0; i < keys.length; i++ ) {
    key = keys[ i ];
    if ( contains( exclude, key ) ) {
        continue;
    }
    k = uncapitalize( replace( key, /^iter/, '' ) );
    methods[ k ] = ns[ key ];
}

// Create a fluent interface:
var FluentIterator = ns.iterFlow( methods );

// Create a new fluent interface iterator:
var it1 = new FluentIterator( randu() );

// Define a predicate function for filtering values:
function predicate( v ) {
    return ( v > 0.25 && v < 0.75 );
}

// Define a function which transforms iterated values:
function transform( v ) {
    return v * 10.0;
}

// Define a function to be invoked for each iterated value:
function log( v ) {
    console.log( v );
}

// Chain together a sequence of operations:
var it2 = it1.filter( predicate )
    .map( transform )
    .head( 10 )
    .forEach( log );

// Perform manual iteration...
var v;
while ( true ) {
    v = it2.next();
    if ( v.done ) {
        break;
    }
}

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

Copyright © 2016-2024. The Stdlib Authors.

hookscloudfrontjsspecObject.istrimRightstreamES5starterkinesistesttoSortedqueuettystyled-componentspicomatchieautoprefixercharacterbindbeanstalkhelpersES2016Array.prototype.flattennegative zeroes2018mruinspectprivate0wordwrapswfchildrapidreducerfindLasthttpisConcatSpreadablereact posecallbacksource mapstdlibprogresseverymanipulationmkdirphttpscallbindinstallernpmstatelessUint32ArrayiterateworkerwafruntimeReactiveXrm -fres2017reuseURLECMAScript 2022valuessidefull-widthwritehas-ownpolyfillarraysortvarsvpcES2020validationdescriptionfullwidtheventEmitterMicrosoftcloudwatchchromiuminputUnderscorecallnativees2016dayjstddtypesafeESECMAScript 2023wordbreakdefinePropertyasynccoerciblecommand-lineURLSearchParamsnegativetoArrayECMAScript 2017react-testing-libraryforkpyyamlserializerRegExp.prototype.flags3d-0transformjshintposevisualboundJSON-SchemaMapestreeremovesearchlistenersenderglobcopyES2022ECMAScript 2015threeexeciterationsequencemobileeslintpluginassertsflattenglobalschemaecmascriptdeep-copyconcurrencyquotelinewrapfileindicatorweaksetmochaspawnimmercolorsgesturesiteratorpatchkeyzoddataViewregular-expressionio-tsrmfindLastIndexwalkmatchessortedduplexPushHyBiwritableconcatUint8ClampedArraybatchdotenvArray.prototype.includescss-in-jsReactiveExtensionsArray.prototype.filterUint8ArraytoolkitforEachcjkcode pointstc39ArrayBufferhardlinksStreambrowserslistisregular expressionfindupextensionebslengthmake dirreworkObject.fromEntriesbuffersymbolECMAScript 2020jsontypeofpackage managersymlinksprotomimetypesrm -rfavamodulestyped arraycore-jsStreamsinferencemapapollorangeerrormakesnschaiAsyncIteratorxtermprotocol-buffersimportexportwrapUint16ArrayquerystringartspinnersetterterminalbannercloudtrailutilitiesrdsexpressionmoduleFloat64Arrayexecutei18nsafejapanesedatastructure.envredirectdynamodbdragbyteLengthyup.gitignorehelperthrottlelockfileparserES2021Symbolbinariesmergeinlimitsubprocesslimitedbreakthroatreact animationTypeBoxpackageFloat32ArraystylescensorapitrimStartcloudformationcolorobjconsolelazysharedarraybufferES6vestpropertiestaptesteriamsetPrototypeOffoldernamestouchoptiongetOwnPropertyDescriptorendpointdependency manageruninstallmkdirsomearraybuffercreatetrimEndimportfunctionalroutetypeerrorjsxbdd256stringifypathjsdiffcodeses-shim APIstreams2postcssdebugObjectpushunicodeformsameValueZeroinstallawesomesaucecryptospeedtimefromdomwaitignore$.extendajaxeast-asian-widthIteratorlook-up
1.0.0

19 days ago