@ndn/naming-convention1
Advanced tools
Comparing version
@@ -13,3 +13,3 @@ import { Component, TT } from "@ndn/packet"; | ||
create(v) { | ||
return new Component(TT.GenericNameComponent, Encoder.encode([this.marker, NNI(v)], 8)); | ||
return new Component(undefined, Encoder.encode([this.marker, NNI(v)], 9)); | ||
} | ||
@@ -16,0 +16,0 @@ parse(comp) { |
@@ -13,3 +13,3 @@ import { Component, TT } from "@ndn/packet"; | ||
create(v) { | ||
return new Component(TT.GenericNameComponent, Encoder.encode([this.marker, NNI(v)], 8)); | ||
return new Component(undefined, Encoder.encode([this.marker, NNI(v)], 9)); | ||
} | ||
@@ -16,0 +16,0 @@ parse(comp) { |
@@ -1,19 +0,14 @@ | ||
import { Component, NamingConvention } from "@ndn/packet"; | ||
declare class Markered implements NamingConvention<number> { | ||
private readonly marker; | ||
constructor(marker: number); | ||
match(comp: Component): boolean; | ||
create(v: number): Component; | ||
parse(comp: Component): number; | ||
import { type NamingConvention } from "@ndn/packet"; | ||
interface NumberConvention extends NamingConvention<number | bigint, number> { | ||
} | ||
/** Segment number marker. */ | ||
export declare const Segment: Markered; | ||
export declare const Segment: NumberConvention; | ||
/** Byte offset marker. */ | ||
export declare const ByteOffset: Markered; | ||
export declare const ByteOffset: NumberConvention; | ||
/** Version marker. */ | ||
export declare const Version: Markered; | ||
export declare const Version: NumberConvention; | ||
/** Timestamp marker. */ | ||
export declare const Timestamp: Markered; | ||
export declare const Timestamp: NumberConvention; | ||
/** Sequence number marker. */ | ||
export declare const SequenceNum: Markered; | ||
export declare const SequenceNum: NumberConvention; | ||
export {}; |
{ | ||
"name": "@ndn/naming-convention1", | ||
"version": "0.0.20210930", | ||
"version": "0.0.20220501", | ||
"description": "NDNts: Naming Convention rev1", | ||
@@ -25,7 +25,8 @@ "keywords": [ | ||
"dependencies": { | ||
"@ndn/packet": "0.0.20210930", | ||
"@ndn/tlv": "0.0.20210930", | ||
"tslib": "^2.3.1" | ||
"@ndn/packet": "0.0.20220501", | ||
"@ndn/tlv": "0.0.20220501", | ||
"tslib": "^2.4.0" | ||
}, | ||
"types": "lib/mod.d.ts" | ||
"types": "lib/mod.d.ts", | ||
"readme": "# @ndn/naming-convention1\n\nThis package is part of [NDNts](https://yoursunny.com/p/NDNts/), Named Data Networking libraries for the modern web.\n\nThis package implements NDN naming conventions based on marker octets.\nThis format, sometimes known as **rev1 format**, is specified in [NDN-TR-0022 revision 1](https://named-data.net/publications/techreports/ndn-tr-22-ndn-memo-naming-conventions/), published in 2014.\nYou should not use this outdated and obsolete format in new applications, except for accessing old data.\nUse **rev3 format** from `@ndn/naming-convention2` package instead.\n\n```ts\nimport { Version, Segment } from \"@ndn/naming-convention1\";\n// We also have ByteOffset, Timestamp, and SequenceNum.\n\n// other imports for examples\nimport { Name } from \"@ndn/packet\";\nimport { strict as assert } from \"node:assert\";\n\n// Append name component with marker.\nconst name = new Name(\"/A\")\n .append(Version, 3)\n .append(Segment, 0);\nassert.equal(name.toString(), \"/8=A/8=%FD%03/8=%00%00\");\n\n// Parse name component as marker.\nassert.equal(name.at(-2).as(Version), 3);\nassert.equal(name.at(-1).as(Segment), 0);\n```\n" | ||
} |
@@ -5,4 +5,6 @@ # @ndn/naming-convention1 | ||
This package implements 2014-version NDN naming conventions as specified in [NDN-TR-0022 revision 1](https://named-data.net/publications/techreports/ndn-tr-22-ndn-memo-naming-conventions/). | ||
For 2019-version naming conventions, use `@ndn/naming-convention2` package. | ||
This package implements NDN naming conventions based on marker octets. | ||
This format, sometimes known as **rev1 format**, is specified in [NDN-TR-0022 revision 1](https://named-data.net/publications/techreports/ndn-tr-22-ndn-memo-naming-conventions/), published in 2014. | ||
You should not use this outdated and obsolete format in new applications, except for accessing old data. | ||
Use **rev3 format** from `@ndn/naming-convention2` package instead. | ||
@@ -9,0 +11,0 @@ ```ts |
6600
59.81%7
40%83
10.67%28
7.69%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated
Updated
Updated