Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @lucidcreative/disguise-asset with all npm packages installed. Try it out:

var disguiseAsset = require("@lucidcreative/disguise-asset")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@lucidcreative/disguise-asset v1.1.0

a simple library for converting a filepath to a disguise asset object


a simple library for converting a filepath to a disguise asset object.

type-safety is included out of the box.

Disguise asset object?

Disguise (aka d3) uses a set of content management rules to manage version replacements and other magic under the hood of their media server. This library attempts to recreate the logic they use to process a file based on it's file name and path. The resulting object looks like:

interface DisguiseAsset {
    stem: string
    extension: string
    version?: string
    proxyLevel?: number
    frameStart?: number
    originalFilename: string

you might notice that version is a string, when all other tags are numbers, and that's because date+letters is also a valid version tag. Versions are always sorted alphabetically.

Benchmark Summary:

1310112 μs
1000.762929 ms
10006.511104 ms
1000000171.870434 ms
  • μs = nanoseconds
  • test hardware:
    • Darwin x64
    • Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
    • 16.0 GB RAM
  • all tests done on randomized data, YMMV

brought to you by


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free