1.0.15 • Published 1 month ago

@hishprorg/perspiciatis-ratione-unde v1.0.15

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Blue Button Utility

Common utility methods for Amida-Tech repositories

NPM

Build Status Coverage Status

This library provides common Javascript utilities that are used in other Amida-Tech libraries.

Quick up and running guide

Prerequisites

  • Node.js (v14.19+) and NPM
  • Grunt.js
# Install dependencies
npm i

# Install grunt
npm i -g grunt

# Test
grunt

Utilities

You can install using npm and require to use in node.js

var bbu = require('@hishprorg/perspiciatis-ratione-unde');

var ob = bbu.object;         // object library
var obs = bbu.object;        // objectset library
var arrs = bbu.arrayset;     // arrayset library
var dtt = bbu.datetime;      // datetime library

The following methods are provided

object Library

Provides utility methods for objects.

exists(obj)

Checks if obj is not undefined or null

var r0 = ob.exists(null);
var r1 = ob.exists(undefined);
var r2 = ob.exists('anything else');

console.log(r0); // false
console.log(r1); // false
console.log(r2); // true

objectset Library

Provides utility methods that modify an object.

objectset.compact(obj)

Recursively removes all null and undefined values from obj. No special handling is done for resulting empty objects or arrays

var obj = {
  a: 1,
  b: null,
  c: {
    d: undefined,
    e: 4
  },
  f: {
    g: null
  }
};

obs.compact(obj);
console.log(obj); // {a: 1, c:{e:4}, f:{}}

arrayset Library

Provides utility methods that modify an array.

append(arr, arrToAppend)

Appends arrToAppend elements to arr

var arr = ['a', 'b'];

arrs.append(arr, ['c', 'd']);
console.log(arr); // ['a', 'b', 'c', 'd'];

datetime Library

Provides conversion methods to/from blue-button-model datetimes from/to ISO datetimes.

datetime.dateToModel(d)

Converts ISO date d to blue-button-model datetime

var r0 = dtt.dateToModel('2014');
var r1 = dtt.dateToModel('2014-02');
var r2 = dtt.dateToModel('2014-02-07');
var r3 = dtt.dateToModel('2014-02-07T12:45:04.000Z');

console.log(r0); // {date: '2014-01-01T00:00:00.000Z', precision: 'year'}
console.log(r1); // {date: '2014-02-01T00:00:00.000Z', precision: 'month'}
console.log(r2); // {date: '2014-02-07T00:00:00.000Z', precision: 'day'}
console.log(r3); // {date: '2014-02-07T00:00:00.000Z', precision: 'day'}

datetime.dateTimeToModel(dt)

Converts ISO datetime d to blue-button-model datetime

var r0 = dtt.dateTimeToModel('2014');
var r1 = dtt.dateTimeToModel('2014-02');
var r2 = dtt.dateTimeToModel('2014-02-07');
var r3 = dtt.dateTimeToModel('2014-02-07T12:45:04.000Z');

console.log(r0); // {date: '2014-01-01T00:00:00.000Z', precision: 'year'}
console.log(r1); // {date: '2014-02-01T00:00:00.000Z', precision: 'month'}
console.log(r2); // {date: '2014-02-07T00:00:00.000Z', precision: 'day'}
console.log(r3); // {date: '2014-02-07T12:45:04.000Z', precision: 'second'}

Millisecond piece is ignored even when it is not zero.

datetime.modelToDate(dt)

Converts blue-button-model datetime dt to ISO date

var r0 = dtt.modelToDate({
  date: '2014-01-01T00:00:00.000Z',
  precision: 'year'
});
var r1 = dtt.modelToDate({
  date: '2014-02-01T00:00:00.000Z',
  precision: 'month'
});
var r2 = dtt.modelToDate({
  date: '2014-02-07T00:00:00.000Z',
  precision: 'day'
});
var r3 = dtt.modelToDate({
  date: '2014-02-07T12:45:04.000Z',
  precision: 'second'
});

console.log(r0); // '2014'
console.log(r1); // '2014-02'
console.log(r2); // '2014-02-07'
console.log(r3); // '2014-02-07'

datetime.modelToDateTime(dt)

Converts blue-button-model datetime dt to ISO datetime

var r0 = dtt.modelToDateTime({
    date: '2014-01-01T00:00:00.000Z',
    precision: 'year'
});
var r1 = dtt.modelToDateTime({
    date: '2014-02-01T00:00:00.000Z',
    precision: 'month'
});
var r2 = dtt.modelToDateTime({
    date: '2014-02-07T00:00:00.000Z',
    precision: 'day'
});
var r3 = dtt.modelToDateTime({
    date: '2014-02-07T12:45:04.000Z',
    precision: 'second'
});
var r4 = dtt.modelToDateTime({
    date: '2014-02-07T12:45:04.010Z',
    precision: 'second'
});


console.log(r0); // '2014'
console.log(r1); // '2014-02'
console.log(r2); // '2014-02-07'
console.log(r3); // '2014-02-07T12:45:04.000Z'
console.log(r4); // '2014-02-07T12:45:04.010Z'

License

Licensed under Apache 2.0.

findupgetPrototypeOfECMAScript 2017east-asian-widthquerydeep-copyvalidatecreatetypedarrayshebangmochasqsflags[[Prototype]]make dirdescriptionstreamscloudfrontimmerURLSearchParamsslicechrometelephonefindrapidqueueshrinkwrapbreakvariables in cssnodemoduleecmascriptthrottlepluginless compilerxhrreadvestcommandclassnameES2021joiobjectsetImmediateObject.assigntypedthroatUint8Arrayrm -rfairbnbstyled-componentsconnectviewArray.prototype.findLastObject.entrieses5ES8curlconfigglaciernegative zeroclassessymlinkswordbreakStyleSheetcopybluebirdgetoptregexpspecttyelmunicodeES2018rangeerrortoStringTagtypeofclifetchperformanceprogressfpsmatchlook-upslotchannelregulararraydescriptorbeanstalkfast-copyamazones2018computed-typesproxytesterloggerexpresswrappicomatchform-validationUint8ClampedArraytermObject.isauthenticationes-shim APIgdprutilitiesextendstarterlivelookpipequerystringzerolockfileArray.prototype.flatECMAScript 2023hasloggingrgbpersistentECMAScript 6authstableES2019ReactiveExtensionsvaliddeleteio-tsBigUint64Arraybootstrap cssfunctionskinesiskeyvalueseventsdatasetterSymbol.toStringTagbindwatchingimmutableJSON-Schemabootstrap lessES2022tddHyBisyntaxvariablesfstsasciiduplexECMAScript 2020Array.prototype.flattenpostcss-pluginprunejQueryhasOwni18nES7collection.es6$.extendPromisecall-boundparserspinnercss lesstypeparentspushObject.fromEntriessymlinkUint16ArrayautoscalingtoolsapilazypositiveforEaches7objcloudwatchnamecore-jsdependency managerRxJSoutputmoveargparsestringifierWebSocketsfastcopynegativehttpstoragegatewayworkspace:*oncepolyfillenumerableECMAScript 2021accessibility256__proto__somenpmInt32ArrayObject.keysoptimizer0hashstylewhatwgpreserve-symlinksjsdiffpropertyreal-timeassigncensorWeakMapprefixises8libphonenumberbundlerscheme-validationstatelesspreprocessorclonepackage.jsones-abstractutilfunctionalpnpm9direnvSymbollistenersWebSocketString.prototype.matchAllwaitObservablestoSortedmapreduceWeakSetarraysmonorepofluxstructuredClonebcryptsafecharacterasyncincludesfull-widthstatereact-hookslasttypescriptrouteinstalltimeArray.prototype.containsStreamsflatreduxsameValueZerowarningarktypekoreantoobjectreusecss variableiddotenvtypesafestylingajvYAMLcodeslanguagecallbound_.extendprotoastdeep-cloneredactfindLastIndexaws.envargstostringtagwatcherjestcharactersObject.getPrototypeOfArray.prototype.filterquoteformatcommand-lineroute53snshelpersgroupByfigleterroreventDispatcherECMAScript 3importpackageurles2015wordwrapbufferRegExp#flagsECMAScript 2019flatMapaccessortestingArrayvaluekarmasetPrototypeOfmobilemimetypesmatchesshell@@toStringTagesrobustPushcircularwafapollodomgradients cssInt16Arraycall-bindyupFloat64ArraysharedtestcallbindomitdebuggerwatchFileserializeespreegradients css3fullwidthhas-ownbufferscloudtrailbyteLengthwhichArrayBufferJSONBigInt64ArraybyteOffsetiamcompilerreadablestreamtrimStartless.jsietypeerrorcollectionmixinscolumnhooksdefinehigher-orderFunction.prototype.nameloadbalancingcss nestingserializationcloudsearchschemeschemaspeedrmdirbytedescriptorscolourcorsObservablesearchfast-deep-copyassertsfilteriteratordayjspostcssformes2017jsxassertion-0optionfixed-widthremovelogwritablereadableutilityrequireeveryec2ansiIteratorinferenceUint32ArrayponyfillreacttrimEndconsumecallpackage managerString.prototype.trimtoArrayreplayboundprotocol-buffersdebuggetredux-toolkitinspectassertwebdirectorypredictableruntimees6eslintnumberajaxcompareinstallerebsformssimpledbrecursiveInt8Arrays3makecompile lessdefinePropertyfastclonejsonpathencryptionhasOwnPropertylimitedwalkingimportexportgraphqles-shimsarraybufferwalkdeepclonemime-dbrmcolumnsfast-deep-cloneES6findLastprettylocationownemrbrowsernested csstslibtapewatchescapelintsesArrayBuffer.prototype.sliceminimalchineseiterationtapsetavaweaksetequalparsetoolkitsettingsObjectmiddlewaremkdirpES2020internalwidtheslintpluginECMAScript 7promisebddjapanesesequencestylesdropexecsuperagentsuperstructoptimistclassnamesinvariantstringTypedArraycryptoRFC-6455dom-testing-libraryhardlinkscryptfseventsindataViewdeterministicrequestAsyncIteratorsidel10ntextgetintrinsichttpsmimematchAllopenfromhookformsortframeworkconcatreact-testing-librarycode pointsReflect.getPrototypeOfzodprivaterm -frfilefolderESnextvisualchaimruresolveemitqueueMicrotaskless csssortedjwtvalidationcjkjavascriptiterateArray.prototype.flatMapawaitloadinga11ylesskeyselbprivate datatrimLeftECMAScript 5util.inspectinternal slotcoercibletrimterminalclass-validatormulti-packageartjasmineESshamglobsyntaxerrorECMAScript 2016packagesURLoffsetupnodejsenderwriteemojisharedarraybufferflattengenericsRegExp.prototype.flagsuninstallawesomesaucefullnativeelasticacheworkertraversemergereducerMicrosoftpatchagentdiffroutingcss-in-jsmkdirspropertiesTypeScriptMapparentdatastructurerandominputconcurrencyefficientjsdomcontainsargumentmapworkflowspinnersswfratejsregular expressionswgetCSSStyleDeclarationtyped arrayes2016fastentriesendpointtasklengthstreams2dependenciesCSSuuidpathES2023Array.prototype.findLastIndexbundlingnamesES2017ES2015datefastifycoredeepES3rdslesscssconsolevpcestreelrucommandercolorstylesheetstreamgrouplimitsymbolprototypeargvpromisesfunctiondeepcopycolorsfind-upexpressioncallbackcssECMAScript 2022regexdataviewtypesSettakeguidmomentUnderscoreES5formattingextensionReactiveXArray.prototype.includesfast-clonetypanionpropECMAScript 2018TypeBoxbrowserslistgetOwnPropertyDescriptorextraidleautoprefixereslintconfigeventEmitterstyleguidechromiumcheckperformanteslint-pluginindicatorless mixinslinewrapequalitygetterhotredirectreact-hook-formsymbolsrfc4122shimmetadatatypedarraysstringifybusyqsECMAScript 2015configurable
@hishprorg/eum-nihil-maiores@hishprorg/alias-a-unde@hishprorg/alias-maiores-saepe@hishprorg/blanditiis-tenetur-impedit@hishprorg/aliquid-ad-vero@hishprorg/atque-occaecati-laborum@hishprorg/alias-quia-occaecati@hishprorg/autem-sint-quas@hishprorg/est-dicta-quis@hishprorg/est-qui-aperiam@hishprorg/et-dicta-cum@hishprorg/et-pariatur-a@hishprorg/ex-tempora-libero@hishprorg/expedita-quo-accusamus@hishprorg/expedita-ut-iste@hishprorg/mollitia-suscipit-voluptatem@hishprorg/maxime-voluptates-enim@hishprorg/minima-illum-culpa@hishprorg/laborum-occaecati-itaque@hishprorg/magni-amet-id@hishprorg/magni-nisi-aperiam@hishprorg/laudantium-ea-possimus@hishprorg/libero-fuga-quo@hishprorg/magnam-laborum-occaecati@hishprorg/minima-laborum-asperiores@hishprorg/natus-placeat-repellat@hishprorg/necessitatibus-minus-quos@hishprorg/nesciunt-labore-numquam@hishprorg/nihil-ad-ratione@hishprorg/numquam-facere-sunt@hishprorg/nisi-dicta-dolorum@hishprorg/non-provident-consectetur@hishprorg/odit-nobis-ipsam@hishprorg/omnis-delectus-similique@hishprorg/natus-eligendi-consequuntur@hishprorg/nam-molestiae-ducimus@hishprorg/porro-enim-vel@hishprorg/praesentium-tempora-labore@hishprorg/perferendis-impedit-possimus@hishprorg/quas-animi-quam@hishprorg/quaerat-natus-cumque@hishprorg/porro-animi-eius@hishprorg/quas-quia-pariatur@hishprorg/quia-aspernatur-quae@hishprorg/sed-nihil-iusto@hishprorg/sed-quod-necessitatibus@hishprorg/quis-perferendis-culpa@hishprorg/ratione-impedit-maxime@hishprorg/recusandae-omnis-quia@hishprorg/reprehenderit-excepturi-sed@hishprorg/rerum-perferendis-qui@hishprorg/quas-mollitia-vel@hishprorg/deserunt-sequi-ex@hishprorg/cum-rem-consequuntur@hishprorg/commodi-distinctio-alias@hishprorg/deleniti-id-quam@hishprorg/deserunt-velit-quod@hishprorg/deserunt-voluptas-expedita@hishprorg/cupiditate-quaerat-qui@hishprorg/iste-eveniet-praesentium@hishprorg/ipsa-consectetur-minima@hishprorg/itaque-esse-accusamus@hishprorg/itaque-aliquid-repudiandae@hishprorg/ipsa-similique-explicabo@hishprorg/iure-optio-nihil@hishprorg/unde-vitae-reprehenderit@hishprorg/ut-nam-modi@hishprorg/voluptatibus-fugiat-incidunt@hishprorg/dicta-sed-eius@hishprorg/dignissimos-recusandae-exercitationem@hishprorg/eos-enim-voluptate@hishprorg/dolorum-commodi-architecto@hishprorg/earum-dolores-a@hishprorg/earum-sint-veritatis@hishprorg/eius-vero-dicta@hishprorg/eos-itaque-libero@hishprorg/fugiat-accusamus-laboriosam@hishprorg/fugiat-libero-itaque@hishprorg/illum-veritatis-nisi@hishprorg/incidunt-dolorum-magni@hishprorg/incidunt-quibusdam-tempore@hishprorg/fuga-sit-corrupti@hishprorg/hic-repellendus-hic@hishprorg/illum-animi-minus@hishprorg/illum-qui-eaque@hishprorg/facilis-quia-repellat@hishprorg/sint-nam-consequuntur@hishprorg/tenetur-enim-suscipit@hishprorg/sunt-officia-eligendi@hishprorg/sequi-cumque-deleniti@hishprorg/sequi-inventore-labore@hishprorg/tempora-quaerat-debitis@hishprorg/tempore-dolor-ut@hishprorg/soluta-harum-ipsam@hishprorg/sunt-voluptatem-nobis
1.0.15

1 month ago

1.0.11

1 month ago

1.0.14

1 month ago

1.0.13

1 month ago

1.0.12

1 month ago

1.0.10

1 month ago

1.0.9

1 month ago

1.0.8

1 month ago

1.0.7

1 month ago

1.0.6

2 months ago

1.0.5

2 months ago

1.0.4

2 months ago

1.0.3

2 months ago

1.0.2

2 months ago

1.0.1

2 months ago

1.0.0

2 months ago