0.0.2-alpha.1 • Published 3 years ago

@sung/subsequence v0.0.2-alpha.1

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

Subsequence

An NPM package for checking if an array is a subsequence of another array.

Usage

const subsequence = require('@dance2die/subsequence');

const input = [5, 1, 22, 25, 6, -1, 8, 10];
const sequence = [1, 6, -1, 10];

const isSubsequence = subsequence.validate(sequence, input)
console.info(isSubsequence);
// prints "true"

// You can validate a Common Subsequence of X and Y
// https://en.wikipedia.org/wiki/Subsequence#Common_subsequence
const x = ['a', 'c', 'b', 'd', 'e', 'g', 'c', 'e', 'd', 'b', 'g'];
const y = ['b', 'e', 'g', 'c', 'f', 'e', 'u', 'b', 'k'];
const z = ['b', 'e', 'e' ]

const isCommonSubsequence = subsequence.validate(z, x, y)
acornababaggregate-erroracorn-jsxacorn-globalsajvacorn-walkansi-colorsansi-escapesansi-regexansi-stylesanymatcharr-diffargparsearr-flattenarr-unionarray-unionarray-uniqueasn1assert-plusastral-regexassign-symbolsasync-eachatobasynckitaws-sign2babel-jestbabel-plugin-dynamic-import-nodebabel-plugin-jest-hoistbabel-plugin-istanbulbabel-preset-current-node-syntaxbabel-preset-jestbalanced-matchbinary-extensionsbrace-expansionbasebcrypt-pbkdfbracesbrowserslistbrowser-process-hrtimeaws4buffer-fromcache-basebsercall-bindcallsitescapture-exitcaniuse-litecaselesschalkchar-regexchokidarclass-utilsci-infocjs-module-lexerclean-stackcamelcasecli-truncatecli-cursorcollect-v8-coveragecollection-visitcliuicolor-namecolor-convertcocombined-streamcolorettecompare-versionsconcat-mapconvert-source-mapcomponent-emittercopy-descriptorcosmiconfigcross-spawncore-util-iscore-js-compatcssomcommanderdebugcssstyledashdashdecamelizedeep-isdecimal.jsdecode-uri-componentdedentdefine-propertiesdelayed-streamdeepmergedata-urlsdefine-propertydetect-newlinedoctrinediff-sequencesdir-globdomexceptionecc-jsbnelectron-to-chromiumemitteryemoji-regexenquirerend-of-streames-abstractes-to-primitiveerror-exescape-string-regexpescaladeeslint-utilseslint-scopeeslint-visitor-keysesprimaespreeesrecurseesqueryescodegenestraverseexec-shesutilsexitextendexecaexpand-bracketsextglobexpectextend-shallowextsprintffast-globfast-levenshteinfast-deep-equalfast-json-stable-stringifyfb-watchmanfill-rangefastqfind-upfile-entry-cacheflattedfiguresfind-versionsflat-cacheforever-agentfor-inform-datafs.realpathfs-readdir-recursivefunction-bindgensyncget-caller-filefunctional-red-black-treeget-intrinsicget-own-enumerable-property-symbolsget-package-typeget-valuegetpassfragment-cacheglob-parentget-streamglobgraceful-fsglobalshar-schemaglobbyhas-flaghar-validatorgrowlyhashas-valuehas-symbolshas-valueshtml-encoding-snifferhttp-signaturehtml-escaperhosted-git-infoiconv-litehuman-signalsimport-freshimurmurhashignoreindent-stringimport-localinflightis-accessor-descriptorinheritsip-regexis-arrayishis-bufferis-date-objectis-callableis-binary-pathis-dockeris-data-descriptoris-extendableis-descriptoris-core-moduleis-ciis-globis-extglobis-negative-zerois-generator-fnis-fullwidth-code-pointis-numberis-objis-plain-objectis-regexis-potential-custom-element-nameis-regexpis-typedarrayis-streamis-symbolis-windowsis-wslisexeistanbul-lib-coverageistanbul-lib-reportistanbul-lib-instrumentisarrayistanbul-reportsistanbul-lib-source-mapsisobjectjest-clijest-changed-filesjest-docblockjest-configjest-diffjest-environment-nodejest-environment-jsdomjest-eachjest-haste-mapjest-leak-detectorjest-get-typejest-matcher-utilsjest-jasmine2jest-mockjest-message-utiljest-pnp-resolverjest-regex-utiljest-resolve-dependenciesjest-resolveisstreamjest-runnerjest-runtimejest-serializerjest-utiljest-snapshotjs-tokensjest-validatejest-workerjsbnjs-yamljest-watcherjson-parse-even-better-errorsjsdomjson-parse-better-errorsjson-schemajson-stringify-safejsescjson-stable-stringify-without-jsonifyjsprimjson-schema-traversekind-oflevenjson5kleurlevnlines-and-columnslocate-pathload-json-filelistr2lodash.sortbylodashlog-symbolsmakeerrorlog-updatemap-cachemake-dirlru-cachemap-visitmerge-streammemorystreammicromatchmime-dbmimic-fnmerge2minimistmime-typesminimatchmsmixin-deepnice-trynanomatchnode-int64node-modules-regexpnatural-comparenode-releasesnode-notifiernormalize-package-datanormalize-pathobject-copynpm-run-pathobject-inspectnwsapioauth-signobject-visitobject.assignobject.pickonceoptionatorobject-keysonetimeopencollective-postinstallp-each-seriesp-limitp-mapp-locatep-finallyp-tryparent-moduleparse-jsonpascalcasepath-dirnameparse5path-is-absolutepath-existspath-keypath-typepicomatchpath-parsepidtreepifyperformance-nowpiratespkg-dirprelude-lsposix-character-classesplease-upgrade-nodeprocess-nextick-argspretty-formatpromptspslpunycodeprogressqsread-pkgreact-ispumpreaddirpread-pkg-upregeneratereadable-streamregexpu-coreregenerate-unicode-propertiesregenerator-runtimeregex-notregenerator-transformregexppremove-trailing-separatorregjsgenregjsparserrepeat-stringrepeat-elementrequest-promise-corerequestrequire-directoryrequire-from-stringrequire-main-filenamerequest-promise-nativeresolveresolve-fromrestore-cursorresolve-cwdresolve-urlretreusifyrimrafrxjssafe-bufferrun-parallelsafe-regexrsvpsafer-buffersemversemver-comparesaxessaneset-blockingsemver-regexset-valueshebang-regexshell-quotesignal-exitslashshellwordsshebang-commandsisteransislice-ansisnapdragonsource-mapsnapdragon-nodesnapdragon-utilsource-map-resolvesource-map-supportsource-map-urlspdx-correctspdx-exceptionssplit-stringspdx-license-idssprintf-jsspdx-expression-parsesshpkstack-utilsstealthy-requirestatic-extendstring-argvstring-lengthstring.prototype.trimendstring.prototype.padendstring-widthstring_decoderstringify-objectstring.prototype.trimstartstrip-ansistrip-eofstrip-bomstrip-final-newlinestrip-json-commentssupports-colorsupports-hyperlinksterminal-linksymbol-treetest-excludetabletext-tablethroattmplthroughto-object-pathto-fast-propertiestough-cookietr46to-regex-rangeto-regextsutilstslibtweetnacltype-detecttunnel-agentunicode-match-property-ecmascripttypedarray-to-buffertype-festunicode-canonical-property-names-ecmascripttype-checkunicode-property-aliases-ecmascriptunicode-match-property-value-ecmascripturi-jsunset-valueuseunion-valueurixutil-deprecateuuidv8-compile-cacheupathvalidate-npm-package-licensev8-to-istanbulverrorwalkerw3c-hr-timew3c-xmlserializerwebidl-conversionswhatwg-mimetypewhatwg-encodingwhichwhich-modulewhich-pm-runswhatwg-urlwrap-ansiwrappyword-wrapwrite-file-atomicwsxml-name-validatorxmlcharsyallistyamly18nyargsyargs-parseryocto-queue
0.0.2-alpha.1

3 years ago

0.0.2-alpha.0

3 years ago