1.0.0 • Published 1 year ago

@crabas0npm2/expedita-qui-accusantium v1.0.0

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

NPM version NPM total downloads

Usage

you can use interface and type by importing Interface and Type.

const { Interface, Type } = require('@crabas0npm2/expedita-qui-accusantium');

Interface:

const { 
  Interface: inter, 
  interfaceUtils 
} = require('@crabas0npm2/expedita-qui-accusantium'); // install the package

const ProfileInterface = {
  Interface: true, // required and must be at first
  
  name: 'string',
  age: 'number',
  gender: interfaceUtils.or('male', 'female'), // to use multi types
  'job[?]': 'string' // not required
};

const myProfile = {
  name: 'someone',
  age: 99,
  gender: 'male'
  // job not required
};

const checkProfile = inter.check(ProfileInterface, myProfile);
console.log(checkProfile); // true

in this example we create interface called ProfileInterface by adding Interface: true in the object to make a interface which is required and must be at top or in first of interface-object.

key options

you can add options to key like the example above, by adding [] at the end of key and add inside it:

  • ? means the key not required, e.g:
const someInterface = {
  'key': 'string', // require
  'anotherKey[?]': '...' // not require
}

const someObject = {
  'key': 'Hello World'
} 
// no errors, 'anotherKey' not required.
  • ! means the key cannot be changed, e.g:
{
  'key[!]': 'value'
}

// after use interface-check
someObject['key'] = 'new value';
console.log(someObject['key']); // value

also you can use both, e.g:

{
  'key[?!]': 'value'
}

Type:

const { Type: type } = require('@crabas0npm2/expedita-qui-accusantium');

const text = 'Hello World';
const getTextType = type.typeOf(text);
console.log(getTextType); // string
const { Type: type } = require('@crabas0npm2/expedita-qui-accusantium');

const text = 'Hello World';
const number = 123;

const isTypeEqual = type.typeOfEqual(text, number);

console.log(isTypeEqual); // false

in above example we import type at first then use function called typeOf to get type of value which is a package called kind-of for more information.

in second example we use function called typeOfEqual to check if first-value type equal second-value type.

features & bugs

you can create a issue to share with us features and bugs on GitHub.

Contributing

1- fork the GitHub repository. 2- make your changes. 3- create pull request on GitHub. thanks ❤️ for your contributing.

nested csscolumnInt32Arraypackage.jsoncompile lessrecursivefilesinatracallboundURLES2020Objectimmutablelinkstyled-componentsconsumetrimparsingjapaneseObservablemrufast-deep-clonefetchrequirees2018extendnodeoperating-systempnpm9trimRightECMAScript 2022Uint32Arraytslibuuidaccessibilitypostcss-pluginMapes5boundRegExp#flagspackagechainpmjoiformatting256mixinsAsyncIteratorsnsarraybufferfast-copyroute53parserinsortimportcryptconfigurablestableString.prototype.matchAllBigInt64ArrayES8endpointlinuxthrottleio-tsreal-timefilterajvdiffES3ReactiveXlintpositivecollectionjsfigletdirpackagescollection.es6Underscorebootstrap lesscallbindprivate datawidthArrayBuffer.prototype.sliceeast-asian-widthArrayBufferES2022getpersistentuninstallopenvisualpipefastCSSdescriptorpasswordreact-testing-librarybatchfastifyelectronfulljsdiffcheckflatMaprapidcryptoutilityHyBitypescripthasOwnPropertystringifytypedmomentthroatconcurrencykinesisartObject.valuescacheredacttypanionstringifierReactiveExtensionsdotenvobjgradients css3iterationECMAScript 2019full-widthequalitysimpledbless cssreactES2015protocol-buffersreplaylanguagedeepstylesheetcss-in-jspruneoutputECMAScript 2020bindkoreansymbolsUint8Arrayrfc4122enumerableremoveeventssetImmediateArray.prototype.containsmiddlewarespinnersymbolwarningwindowseventDispatcherdatastructurefunctionalttycloudtrailgroupecmascriptconcatsignalsponyfilljsxfindupcall-boundexpressionzodECMAScript 7toolkitidlesetterrestsortedmergeerrorbootstrap cssWebSocketsbeanstalkpromiseguidperformanceObject.getPrototypeOfparentwalkes-shimstrimStartECMAScript 2018rdsendercoreJSON-SchemaWeakMapwatchingappformarktypeglaciertextquotees2017authsignalECMAScript 6browserslisttoArrayObject.entriesJSONcss nestingPromisebundlingwordbreakyupintrinsicmoduleregexpcolorTypedArrayconsoledataviewcall-bindgetOwnPropertyDescriptorstartercomputed-typesbyteOffsetasciiconfigECMAScript 2016__proto__propduplexfastcopytestingObject.definePropertystatejsonpathbyteCSSStyleDeclarationsideassertionassertspyyamlemojiauthenticationlastcorsminimalreadargumentcommandcharacterielogoncemake dirimportexportchromemonorepolook-upArray.prototype.flatMapnodejs$.extendRFC-6455ES2016timeimmerbundlerkarmacolorsargparsenamesprogressshebangsigintStreamsbusySetchineseupphonetypesafeBigUint64Arrayglobtoobjectreduceelbfile systemeslintconfigflagsnativeECMAScript 5package managerbyteLengthtypesformatReflect.getPrototypeOfbanneridmatchesslotcloudformationdeterministicgetPrototypeOfcjkfolderrestfulescapeless compilerqueryextensions3functionsArray.prototype.findLastIndexextrajwttoolsObject.isiamserializationrequesta11yweaksetpropertyES2021keyRegExp.prototype.flagsargslinewrapelmarrayrobustschemastreamutil.inspectwritablelimitObject.keysspeedcompilergetoptsameValueZeroterminalvalidqueueMicrotaskStyleSheetmoveownlockfilemkdirswfredux-toolkitprettydateES6workspace:*superagenthookformsafeutilprototypehttpsshamcontainsfluxhas-ownliveES2017ES7command-linehotpolyfillspinners
1.0.0

1 year ago