1.0.5 • Published 6 days ago

@teamteanpm2024/tempore-non-vitae v1.0.5

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

minified size minified zipped size types license npm-publish

Social Links

Social Links is helping to detect, validate and sanitize social (desktop & mobile) links

Install

npm i @teamteanpm2024/tempore-non-vitae --save

Demo

Using

import { SocialLinks, TYPE_MOBILE } from '@teamteanpm2024/tempore-non-vitae';
const socialLinks = new SocialLinks();

const link = 'http://www.linkedin.com/in/gkucmierz';
const profileName = socialLinks.detectProfile(link); // 'linkedin'

console.log(socialLinks.isValid(profileName, link)); // true
console.log(socialLinks.sanitize(profileName, link)); // 'https://linkedin.com/in/gkucmierz'
console.log(socialLinks.sanitize(profileName, link, TYPE_MOBILE)); // 'https://linkedin.com/mwlite/in/gkucmierz'

Above examples works based on predefined linkedin profile:

import { Profile } from '@teamteanpm2024/tempore-non-vitae';
const linkedinProfile: Profile =
{ name: 'linkedin',
    matches: [
      {
        match: '(https?://)?(www.)?linkedin.com/in/({PROFILE_ID})', group: 3, type: TYPE_DESKTOP,
        pattern: 'https://linkedin.com/in/{PROFILE_ID}'
      },
      {
        match: '(https?://)?(www.)?linkedin.com/mwlite/in/({PROFILE_ID})', group: 3, type: TYPE_MOBILE,
        pattern: 'https://linkedin.com/mwlite/in/{PROFILE_ID}'
      },
      { match: '({PROFILE_ID})', group: 1 },
    ]
};

Add new profile

import { SocialLinks, Profile } from '@teamteanpm2024/tempore-non-vitae';

const socialLinks = new SocialLinks();
const profileMatches: ProfileMatch[] = [ ... ];

socialLinks.addProfile('profileName', profileMatches);

Configuration

import { SocialLinks, Config } from '@teamteanpm2024/tempore-non-vitae';

const config: Config = {
  usePredefinedProfiles: true,
  trimInput: true,
  allowQueryParams: false,
};
const socialLinks = new SocialLinks(config);

Build

Watch, tsc build

npm run start

Tests

Just jest tests

npm run test

or

npm run test:watch

Contributing

CONTRIBUTING.md

Uint8ArrayStyleSheetIteratorregexxtermreal-timereduxnpmfindLastspringqueueimmutabletoolsES3frameworkoptimistsqsyupcommandqueueMicrotaskString.prototype.matchAlllimitedbrowseri18npropertiesbindCSSStyleDeclarationrm -frasynclinuxtc39json-schema-validatortypedarrayssetgestureseslintWebSocketmruimportchaipicomatchRxJSpostcss-pluginObservablefunctionalprototypeECMAScript 2019ECMAScript 2017scheme_.extendcjknamecolumnsjasminecloudtrailcall-boundquerystringInt8Arrayreact animationECMAScript 6coredynamodbargvdescriptorsReactiveXinterruptswidthESnextstreamsprefixjsxreact posetrimStartRFC-6455trimLeftless mixinsES2023passwordstarternodecore-jsbrowserslistzeroduplexparsemkdirpSymbol.toStringTaghttpwindowses8emrbootstrap cssbeanstalkvariablesdeep-copyObject.fromEntriessnscirculartouchauthcallbacklook-upproxyenderes6Streamspromisescharactereslintpluginbusysyntaxassertseast-asian-widthparents3-0ecmascriptvaluesrecursivesigintnamesutilsmkdirshrinkwrapfpsfunctionwafsaferuntimefixed-widthpackagesavatraverseArrayBuffer.prototype.slicegradients csstslibless.jsajaxessanitizeYAMLes5asciiES2016elbxsslintkinesissideconsolegenericsfantasy-landWeakMapkeystacitpackage managerlesscsssomevisualeveryoncedebuggercorsloggingprunewhatwgfseventsdeepcopyschemagetterdependencieschannelfindes-shimscopypathisConcatSpreadablenegative zerofilereact-testing-librarypackage.jsonObjectwritableglobmatchAlltranspilexhrsymbolmiddlewarevalueHyBivalidprotobufscheme-validationRegExp#flagswatchFileECMAScript 2016arraybufferindicatorbrowserlistsignaltoStringTagtypeerroridlelengthstylesmodulenopeECMAScript 5Symbolfetchguidtypedslotbabel-corelimitsettertsdeepcloneratekoreanupstreamtextrgbowndefineequalhasOwnPropertyWeakSetwarningjQueryjoiclassesshellweakmapgetUint8ClampedArraymonorepoargumenttypesafeweaksetestreedatemodulesES5fast-deep-copyflattenfullwidthcompile lessdataviewexecURLSearchParamsECMAScript 3getoptfastfast-cloneTypedArraylessAsyncIteratorECMAScript 2021openauthenticationuuiddragregular expressionsArray.prototype.containsObject.entriesargsflatMaptesterObservablespyyamlapigetOwnPropertyDescriptornegativeformstypedarrayObject.getPrototypeOfshamsequenceclassnameslastmapreducecallimmercreatematchesObject.definePropertyArray.prototype.flattenmacoschromiumES2017Reflect.getPrototypeOfhooksprivatefpjwtjson-schema-validationformrmdirArray.prototype.findLastIndexdatastructuresesflatfsmimepersistenttrimEndbabelenvprettymobilerobustiamshebangcommandertyped arrayerror-handlingrm -rfmapdirectoryhasinstallerdescriptionuser-streamssearchfile systemsameValueZerodayjsirqwordbreaksetImmediateerrorio-tsJSONbuffer6to5regexpreadarraysprocessES7less compileres-shim APIelasticachefind-upArrayBuffercloudfrontassertionBigInt64Arrayjson-schemaInt32ArrayaccessorcssmetadataharmonydataViewinspect@@toStringTagprotoefficienttaptaskinvariantwalkpostcsscodespopmotion.envjsdiff__proto__Object.isdescriptorswfRxES2015urloperating-systemcolorastchrometimezodgroupByjestlazysharedarraybufferrequestgroupvestTypeBoxUnderscoreincludesautoscalingstreams2eventDispatchervalidateinternal slotURLsanitizationebscallbounddeterministicvalidatorsymlinksworkflowtostringtagisyamlvalidationserializerautoprefixeroffsetpackageloggerjapanesefunctions256wrap0es2017shimdomconfigurableamazoncss variableglaciercharactersprivate datastylingFloat32ArraydefinePropertyECMAScript 2020es2018slicewriteESkarmastyled-componentstakecollectionless cssec2RegExp.prototype.flagsTypeScriptinstallbatchiterationarrayintrinsicECMAScript 2023ajvhasOwnconstvpccall-bindenumerablegdprnumbercollection.es6regularargparsepushconsumecomparebuffersJSON-Schemadeletecommand-lineprotocol-buffersmakeprogressnodejscss-in-jscode pointsclassnamewgetminimalplugincolorsvarpromisekeyStreamboundES8util.inspectartcompilersymbolstelephonefastcopypoint-freeserializationcallbindsymlinktypeclonefast-deep-cloneutilrandomcomputed-typesdebugbyteLengthsetPrototypeOfeslint-pluginstringvariables in cssquotejsonschemahas-ownECMAScript 2015flagreusefindupparentsimportexportcss lessexpressionmime-dbregular expressiongradients css3storagegatewayexit-codetoArrayrfc4122parsingdeep-cloneArrayBuffer#sliceassignextensionArray.prototype.flatenvironmentoptimizereventEmitterlinewrapwordwrapmimetypessortedcliform-validationviewcensorES2019tddtypeofwhichtypessuperstructclass-validatorlockfileeslintconfiglookcryptdiffdirbreakcrypto
1.0.5

6 days ago

1.0.4

7 days ago

1.0.3

8 days ago

1.0.2

9 days ago

1.0.1

10 days ago

1.0.0

11 days ago