id

v1.1.5arrow_drop_down
v1.1.5
v1.1.4
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.1.3
v0.1.2
v0.1.1
v0.1.0
v0.0.12
v0.0.11
v0.0.10
v0.0.9
v0.0.8
v0.0.7
v0.0.6
v0.0.5
v0.0.4
v0.0.3
v0.0.2
v0.0.1
STATUS
Passing
DOWNLOADS
8,624
LICENSE
Apache 2.0
VISIBILITY
Public
PUBLISHED
6 years ago
SIZE
N/A
Parse, update and format bit ids. TODO: * upgrade to TS * support local component names (ie. 'string/optional') * parsing for scopes ids (as a separate component?) * .fromString() / .toString() syntax * .formObj() / .toObj()
1 contributor
Install id as a package?
Copied
npm i @bit/bit.javascript.component.id
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
construtor (
owner:string,
scope:string,
fullName:Array<string>,
name:string,
version:string
)

initialize class to handle bitIds

Example
const parsedBitId = new BitId('uri', 'kutorg', 'component/is-string', '1.0.0');
Arguments
owner: string
scope: string
fullName: Array<string>
name: string
version: string
toNpmId (
options:Object,
boolean:boolean,
boolean:boolean,
boolean:boolean,
boolean:boolean
)

create npm id

Arguments
options: Object
boolean: boolean

[options.includeVersion] - includes ‘@x.x.x’ at the end of the result

boolean: boolean

[options.includeFilePath] - includes ‘/dist/file.js’ at the end of the result

boolean: boolean

[options.includeRegistry] - includes ‘@bit/’ registry at the start of the result

boolean: boolean

[options.includePrefix] - DEPRECATED includes ‘@bit/’ registry at the start of the result

toBitId ()

create bitId

fromBitId (
id:string
)

convert string to bitId

Argument
id: string
Returns

BitId

Properties
NameTypeDescription
string

[scopeId] - alternative representation of owner + scope names. Used in specific methods with the overrideOwnerScopeWithScopeid flag.

registry
string

all bit components will have the “bit” as registry (compatible with NpmIds)

Test Summary

ctor should instaciate

Pass

ctor should instaciate with version

Pass

ctor should instaciate with many fullName

Pass

npm id should create npm id

Pass

npm id should create npm id, when without fullName

Pass

npm id should create npm id, when without version

Pass

npm id should parse npm id, when npm id is without scoped registry when enforceScopedBitRegistry is false

Pass

npm id should not include scopeId, even when included

Pass

npm id should not parse npm id, when npm id is without scoped registry when enforceScopedBitRegistry is true

Pass

npm id should fallback to NpmId, when allowFallbackToNpm is true

Pass

npm id should fallback to NpmId, with filepath

Pass

npm id should return undefined, when allowFallbackToNpm is false

Pass

npm id should throw, when allowFallbackToNpm is true and enforceScopedBitRegistry is false

Pass

npm id should create npm id, without prefix, by option

Pass

npm id should not include version, by option

Pass

npm id should not include version and prefix, by option

Pass

npm id should return undefined, when no proper @bit

Pass

npm id should return undefined, when too short

Pass

npm id should return undefined, when two versions

Pass

npm id should return undefined, when two versions

Pass

npm id should create from npmId

Pass

npm id should create from npmId, without version

Pass

npm id should create from npmId, with many fullName

Pass

npm id should create from npmId, with no fullName

Pass

npm id should create from npmId, with no fullName but with version

Pass

npm id should create from npmId, with filePath

Pass

npm id should create from npmId, with filePath

Pass

bitId should create bitId

Pass

bitId should create bitId, without fullName

Pass

bitId should create bitId, one namespace

Pass

bitId should create bitId, with version

Pass

bitId should not include scopeId, even when included

Pass

bitId should create from bitId

Pass

bitId should create from bitId with version

Pass

bitId should create from bitId

Pass

bitId should create from bitId, with many fullName

Pass

bitId should create from bitId, with no fullName

Pass

url should create url

Pass

url should create url, one namespace

Pass

url should create url with more than two namespaces

Pass

url should use owner and scope names, when scramebleUsingScopeId, even when scopeId is set

Pass

url should create with scopeId instead of owner name and scope name, when option overrideOwnerScopeWithScopeid is true

Pass

url should create queryParams with version

Pass

url should create queryParams with version by default, when ‘withVersion’ was not used

Pass

url should create queryParams without version, when ‘withVersion’ is set to false

Pass

url should create pathParams with version

Pass

url should create pathParams with version by default, when ‘withVersion’ was not used

Pass

url should create pathParams without version, when ‘withVersion’ is set to false

Pass

url should create from url, with many fullName

Pass

url should create from url, with one namespace

Pass

url should create from url, when starting with leading slash

Pass

fullname should create fullName

Pass

fullname should create fullName, one namespace

Pass

name getter should extart name, when available

Pass

name getter should extart name when fullname and array with length of one

Pass

nameSpace getter should extart nameSpace from fullName

Pass

nameSpace getter should return empty array when fullName array length is one

Pass
Help and resources