3.8.104 • Published 4 months ago

@hishprorg/perspiciatis-ratione-unde v3.8.104

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months 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/ipsa-consectetur-minima@hishprorg/nemo-blanditiis@hishprorg/neque-laborum-vel@hishprorg/quis-quibusdam@hishprorg/quibusdam-dolores@hishprorg/quis-doloribus@hishprorg/quidem-delectus@hishprorg/quidem-et@hishprorg/quis-est@hishprorg/quis-perferendis-culpa@hishprorg/sed-nihil-iusto@hishprorg/sequi-inventore-labore@hishprorg/sed-sunt@hishprorg/temporibus-aliquam-neque@hishprorg/tempore-dolor-ut@hishprorg/accusantium-architecto@hishprorg/ad-labore-dolor@hishprorg/ad-minima@hishprorg/ad-soluta-et@hishprorg/accusantium-consectetur-incidunt@hishprorg/beatae-cumque@hishprorg/beatae-animi-commodi@hishprorg/autem-quo@hishprorg/debitis-quaerat@hishprorg/debitis-qui@hishprorg/cupiditate-ut@hishprorg/dolores-ut@hishprorg/et-esse-quasi@hishprorg/est-odio-laudantium@hishprorg/eum-eos@hishprorg/et-dicta-cum@hishprorg/eum-nihil-maiores@hishprorg/illo-voluptas@hishprorg/impedit-consectetur-dicta@hishprorg/architecto-sequi@hishprorg/architecto-sapiente@hishprorg/asperiores-hic@hishprorg/aspernatur-consequatur@hishprorg/asperiores-voluptates@hishprorg/asperiores-provident@hishprorg/consectetur-sunt@hishprorg/consectetur-ab@hishprorg/consectetur-dolores@hishprorg/deserunt-est@hishprorg/deserunt-velit-quod@hishprorg/deserunt-nihil@hishprorg/deserunt-deleniti@hishprorg/doloremque-soluta@hishprorg/doloremque-mollitia@hishprorg/dolore-suscipit@hishprorg/hic-omnis@hishprorg/hic-perferendis@hishprorg/fuga-repellat@hishprorg/fugiat-accusamus-laboriosam@hishprorg/fugiat-eius@hishprorg/fugiat-libero-itaque@hishprorg/aliquam-quibusdam-repudiandae@hishprorg/aliquid-delectus-nisi@hishprorg/aliquid-ut-debitis@hishprorg/alias-maiores-saepe@hishprorg/amet-qui@hishprorg/aliquid-ad-vero@hishprorg/beatae-officia@hishprorg/earum-occaecati@hishprorg/earum-sint-veritatis@hishprorg/earum-inventore@hishprorg/earum-consectetur@hishprorg/est-dicta-quis@hishprorg/esse-voluptates-veritatis@hishprorg/id-ab@hishprorg/id-harum@hishprorg/id-modi@hishprorg/id-dignissimos@hishprorg/id-voluptas@hishprorg/id-consequuntur@hishprorg/hic-repellendus-hic@hishprorg/illo-dolores@hishprorg/cum-rem-consequuntur@hishprorg/cumque-optio@hishprorg/cupiditate-quaerat-qui@hishprorg/doloribus-vero@hishprorg/dolorum-commodi-architecto@hishprorg/doloribus-reiciendis@hishprorg/doloribus-minima@hishprorg/dolorum-est@hishprorg/exercitationem-ipsum@hishprorg/distinctio-repudiandae-molestias@hishprorg/distinctio-alias@hishprorg/dignissimos-sunt-quaerat@hishprorg/distinctio-in@hishprorg/eos-enim-voluptate@hishprorg/eos-asperiores@hishprorg/eligendi-laborum@hishprorg/enim-fugiat-quas@hishprorg/eligendi-neque@hishprorg/eveniet-maxime@hishprorg/ex-tempora-libero@hishprorg/architecto-consectetur@hishprorg/culpa-ea-facilis@hishprorg/culpa-ratione-dolores
3.6.69

5 months ago

3.6.68

5 months ago

3.6.67

5 months ago

3.6.66

5 months ago

3.6.65

5 months ago

3.6.64

5 months ago

3.6.63

5 months ago

3.6.62

5 months ago

1.4.24

7 months ago

3.6.61

5 months ago

1.4.23

7 months ago

3.6.60

5 months ago

3.6.76

5 months ago

3.6.75

5 months ago

3.6.74

5 months ago

3.6.73

5 months ago

3.6.72

5 months ago

3.6.71

5 months ago

3.6.70

5 months ago

1.2.17

7 months ago

3.7.99

4 months ago

3.7.97

4 months ago

3.7.98

4 months ago

3.7.95

4 months ago

3.7.96

4 months ago

3.7.93

4 months ago

3.7.94

4 months ago

3.7.91

4 months ago

1.1.16

7 months ago

3.7.92

4 months ago

1.1.15

7 months ago

3.7.90

4 months ago

3.6.59

5 months ago

3.6.58

5 months ago

1.1.17

7 months ago

3.5.58

6 months ago

3.5.57

6 months ago

3.7.79

5 months ago

3.5.56

6 months ago

3.5.55

6 months ago

3.7.77

5 months ago

3.5.54

6 months ago

3.7.78

5 months ago

3.5.53

6 months ago

3.5.52

6 months ago

3.7.76

5 months ago

3.5.51

6 months ago

3.5.50

6 months ago

1.3.17

7 months ago

1.3.18

7 months ago

1.3.19

7 months ago

3.7.88

4 months ago

3.7.89

4 months ago

3.7.86

5 months ago

3.7.87

4 months ago

1.3.20

7 months ago

1.3.21

7 months ago

3.7.84

5 months ago

3.7.100

4 months ago

3.7.85

5 months ago

3.7.82

5 months ago

1.3.22

7 months ago

3.7.83

5 months ago

1.3.23

7 months ago

3.8.104

4 months ago

3.7.80

5 months ago

3.7.81

5 months ago

3.7.103

4 months ago

3.7.104

4 months ago

3.7.101

4 months ago

3.7.102

4 months ago

3.5.39

6 months ago

3.5.38

6 months ago

2.5.29

7 months ago

2.5.25

7 months ago

2.5.26

7 months ago

2.5.27

7 months ago

2.5.28

7 months ago

2.5.24

7 months ago

3.5.47

6 months ago

3.5.46

6 months ago

3.5.45

6 months ago

3.5.44

6 months ago

3.5.43

6 months ago

3.5.42

6 months ago

3.5.41

6 months ago

3.5.40

6 months ago

3.5.49

6 months ago

3.5.48

6 months ago

2.5.36

6 months ago

2.5.37

6 months ago

2.5.38

6 months ago

2.5.32

6 months ago

2.5.33

6 months ago

1.5.24

7 months ago

2.5.34

6 months ago

2.5.35

6 months ago

2.5.30

6 months ago

2.5.31

6 months ago

1.0.15

7 months ago

1.0.11

7 months ago

1.0.14

7 months ago

1.0.13

7 months ago

1.0.12

7 months ago

1.0.10

7 months ago

1.0.9

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago