@oegea/timecode-converter
v1.0.0
Published
> **IMPORTANT NOTICE:** This is a fork of the original timecode-converter library made by pietrop, updated to be compatible with Node.js 22 and more modern versions of Node. The original library was designed for Node 12 and has not been updated to work wi
Downloads
49
Readme
timecode-converter
IMPORTANT NOTICE: This is a fork of the original timecode-converter library made by pietrop, updated to be compatible with Node.js 22 and more modern versions of Node. The original library was designed for Node 12 and has not been updated to work with current Node.js environments, so there were some import statements that were failing.
A dependency-free timecode-converter module utility that can be used either client-side or server-side. Originally extracted from @bbc/react-transcript-editor/packages/util/timecode-converter, with original code domain logic from @bevand10 🙌
The problem of exporting it from @bbc/react-transcript-editor or @pietrop/slate-transcript-editor is that, somehow it ends up expecting react as a peer dependency.
And besides that not being ideal, or good practice, not only it can cause problems with keeping up with react peer dependency of other modules, but also add that as a peer dependency to other module consuming it, such as @pietrop/edl-composer that doesn't really need any of that.
Setup
git clone [email protected]:oegea/timecode-converter.gitcd timecode-converternpm installUsage
Some examples (see the test files for more):
import { secondsToTimecode, timecodeToSeconds, shortTimecode } from "@oegea/timecode-converter";
const result1 = secondsToTimecode(600);
// '00:10:00:00'
const result2 = timecodeToSeconds('00:10:00:00');
// 600
const result3 = shortTimecode(0)
// '00:00:00'
const result4 = shortTimecode('00:10:00:00')
// '00:10:00'System Architecture
A node module
Development env
- npm >
6.1.0 - Node.js 22+
Node version is set in node version manager .nvmrc
nvm useBuild
NA
Tests
npm run testsee Jest & ECMAScript Modules in their docs, for more info.
Deployment
To publish to npm:
npm run publish:publicand for pre-flight checks 🔦🛫:
npm run publish:dry:run