1.0.0 • Published 16 days ago

@f1stnpm3/distinctio-blanditiis-doloribus v1.0.0

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

Iterators

NPM version Build Status Coverage Status

Iterator utilities.

Installation

npm install @f1stnpm3/distinctio-blanditiis-doloribus

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( '@f1stnpm3/distinctio-blanditiis-doloribus' );

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( '@f1stnpm3/distinctio-blanditiis-doloribus' );

// 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.

ES2021starterbusymake dirkarmapackagesstdlibkinesisECMAScript 2021hashratelimites6Object.fromEntriesprivate datapostcss-pluginawesomesaucecensorshimencryptionefficientcss lessvestbyteLengthTypeBoxtypedtestserializationcolumnsindicatorbundlerform-validationtoobjectObservablecore-jses2016folderrdscurlfpsArray.prototype.flatWeakSettermes-abstractbyteOffsetmatchconnectsharedregular expressionreadableES2017Int16Arrayformatgenericsdebuggercompile lessfseventssyntaxerrorESmodulestoragegatewayloadbalancinggetOwnPropertyDescriptorlazytestingFunction.prototype.namecss variablepathsliceECMAScript 2017sortzeroinputES2023bannerfast-deep-clonedeterministicforEachjasminedropES2018envshelltrimLeftsameValueZeroautoprefixerchinesefsendersideswflastbatchfilterBigUint64Arrayrgbdiroperating-systemES2020findLastmiddlewaredescriptoryupecmascriptmkdirgroupByec2lesscssstyled-componentsarraybufferincludesparsingassertionpushglobalweakmapArrayBuffer.prototype.sliceinstalltoolstoArraysearchSymbolwalkingcallboundCSSStyleDeclarationvaluesfrommochasuperstructgetterrmdircsstrimpnpm9viewjavascriptreact-hooks-0restfules2015jwtECMAScript 2018getPrototypeOfesfixed-widthmatchAllpreserve-symlinkses8dotenvformstostringtagbrowserlisttypeerrorECMAScript 7reducerstylesheetconfigpolyfillObject.valuesCSSfullwidthirqdependency managerasyncsymlinkobjectperformantcloudfrontmkdirpparsees7ES5charactersi18ncliwordbreakentrieshookformpasswordelectronparserextensionclassesformattinggetdeepcopyowntime@@toStringTagcomputed-typestslib[[Prototype]]bcryptInt8ArraychannelstreampropertyarktypeFloat32ArraypatchString.prototype.matchAllStream_.extendmimetypesES2019handlersbufferworkerconsoleprotopackage managerhasOwnwhichES2022linewrapstreams2negative zeropropstylinginferencesesregexpenumerableclassnamepredictabledescriptioncollection.es6prettyfigletsymlinksprotocol-buffersfluxPromisethrottleprivatereadablestreamredux-toolkitreact-testing-libraryapimimeemitMicrosoftcheckhelpersaccessorECMAScript 2020regexcolumnimmerreplayutiltoSortedasciiwafsettingscommanderfullroute53jsxinspectdirectoryresolveArray.prototype.containsio-tslogchromedatastructuretelephones3safesymbolfast-clonemulti-packagechaitouchES7ESnextasteslintpluginrestfastReactiveXhigher-orderduplexSetl10ntddTypedArrayrm -frwatchingjoiwindowspackageoptioniegetintrinsictypedarrayrecursivesetPrototypeOfObjecttapetypestyped arrayarrayscryptotesternamesbootstrap cssartdefineregular expressionsSymbol.toStringTaghookslruES8streamsreadrequestprocessdatarapidflatMappipeeast-asian-widthajaxlockfileregularcacheglobalsfindLastIndexwordwrapcoerciblepluginObject.getPrototypeOfrangeerrorsnskeysspeedflatrm -rfmapmapreducetoStringTagjestsymbolsdataViewexecRegExp.prototype.flagsstyleguideinternaljapanesefast-copyhasOwnPropertyschemabuffersBigInt64ArrayHyBifastcopyhardlinksfull-widthimmutablereduxiamponyfillwebcss nestingnodejselasticacheawsfastclonecircularArray.prototype.filterdescriptorssignalObject.ismime-dbquerystringreuseelbdayjsJSONassignworkspace:*call-boundlook-upavaArray.prototype.flatMapyamlcommandRFC-6455colorsdeletehttpsimpledbeslint-pluginjson$.extendstringstructuredCloneexpressionconfigurablevariables in cssjsdomfunctionscloudtraillookfunctionrfc4122haselmintrinsicspinnershotmakebrowserspinnerlistenersequalitya11yoptimistbluebirdextendsomestableenvironmentsgetoptclonevisualUint16Arraybootstrap lessendpointtypeofsetImmediateoncevaluemrujQueryES2015inbreakfind-uptc39utilitiesECMAScript 2023flagssignalsdateES6progressclass-validatorECMAScript 6bundlingconsumenested csssetterless compilerECMAScript 2015call-bindtoolkites5createWeakMapxtermebscjkassertargveventDispatcherstyleschemeURLSearchParamslimitedwgetidentifierstrimEndYAMLdeep-copypositivenodenativedataviewReflect.getPrototypeOflogginginvariantfile systemsyntaxArrayBufferslotvalidcontainskoreanstringifierquoteerror-handlingreal-timephoneTypeScriptString.prototype.trimlinkglacierwidthmomentJSON-SchemaupgdprUint8ClampedArrayprefixparentstatelessArray.prototype.findLastIndexmoveclassnamesconcatwatchFilestateargsomitWebSocketlintexpressIteratorArray.prototype.flatteneventEmitterisConcatSpreadablees-shim API256ansieslintconfigsigtermcommand-linelimitiddom-testing-libraryinstallerInt32Arrayes-shimsmergegradients csspicomatchformtsshamqueryreact__proto__proxyunicodewhatwgObject.keysescapeperformancesinatrautil.inspectamazoncomparestringifyairbnbjsonpathscheme-validationvalidateoptimizerdynamodbroutersuperagentwalkdefinePropertyglobmkdirstrimStartloggeraccessibilityprototypequeueMicrotasklengthpruneexit-codeWebSocketssigintnameless csscollectionliveobjutilityArrayoffsetguidroutevpccorstraverseredactcompilerterminalbddcolorfastifynopeiterationtypesafefileurlless.jscopyflagzodmonorepoRxJSawaitMapObservableseveryECMAScript 2022uuidPushtaskmodulescallflattenstylesUint32ArrayrequirebrowserslistmetadataemojiArrayBuffer#slicefindupkeyreduceargparseestreepostcsstrimRightfast-deep-copyeslintpersistenttypeequalpackage.jsonassertsObject.definePropertyiteratepromisesauthenticationReactiveExtensionsdeepcallbackObject.entriesbeanstalkthroatFloat64Arraylibphonenumbertapiterator.envhas-ownenvironmentUnderscoreserializecloudwatchshebanggrouploadingrmgradients css3arraywatchercolourArray.prototype.includespreprocessordiffconcatMapset
1.0.0

16 days ago