Code Monkey home page Code Monkey logo

id-components's Introduction

id-components

Utility library for composing compound identifiers that survive url-encoding

Note components of compound identifiers are lowercase.

@raydeck/id-components - v1.0.3

Index

Functions

Functions

cleanComponent

cleanComponent(component: string): string

Defined in index.ts:68

Clean a component for use (lower-case)

Parameters:

Name Type Description
component string component string to clean up

Returns: string


decodeComponent

decodeComponent(component: string): string

Defined in index.ts:61

Decode a component previously wrapped by encodeCOmponent (and should be the same if it was not encoded previously)

Parameters:

Name Type Description
component string string to decode

Returns: string


encodeComponent

encodeComponent(component: string): string

Defined in index.ts:53

Encode a component in an un-wrappable way

Parameters:

Name Type Description
component string string to encode

Returns: string


isCompoundId

isCompoundId(id: string): boolean

Defined in index.ts:38

Determine whether the string is a compound id

Parameters:

Name Type Description
id string string to test

Returns: boolean


makeCompoundId

makeCompoundId(primaryId: string, secondaryId: string): string

Defined in index.ts:46

Create a compound ID from two other ids

Parameters:

Name Type Description
primaryId string Primary id (goes first in the list)
secondaryId string Secondary id (goes second - usually locally unique to the primary)

Returns: string


parseCompoundId

parseCompoundId(id: string): string[]

Defined in index.ts:25

Parse a compound id (e.g. url-encoded and joined with slashses) into its constituent components

Parameters:

Name Type Description
id string

Returns: string[]


parseUri

parseUri(uri: string): string[]

Defined in index.ts:75

Parse a URI into scheme and host components for uri-ization

Parameters:

Name Type Description
uri string URI to parse

Returns: string[]


undefinedIfError

undefinedIfErrorT›(fnc: function, defaultValue: T | undefined): Promise‹T | undefined›

Defined in index.ts:10

Check a function and return the defaultValue in the event it returns an error (rather than throwing)

Type parameters:

T

Type of expected return

Parameters:

fnc: function

Asynchronous (promise-returning) function

▸ (): Promise‹T›

Default value defaultValue: T | undefined= undefined

Value to return in the event of an error

Returns: Promise‹T | undefined›

id-components's People

Contributors

rhdeck avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.