Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@qualified/ccc-files

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@qualified/ccc-files

Provides a function to map ClassicCodeChallenge fields to files

  • 0.2.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

@qualified/ccc-files

Provides a function to map ClassicCodeChallenge fields to files.

type FileWithSource = {
  path: string;
  contents: string;
  source: "solution" | "tests" | "preloaded" | "generated";
};

type ClassicCodeChallenge = {
  preloaded?: string;
  solution: string;
  tests: string;
  language: string;
  languageVersion?: string;
  testFramework: string;
  preset?: string;
};

type Options = {
  /**
   * For paths based on the field value, fall back to a predefined path instead of
   * throwing an error on invalid value.
   */
  fallback?: boolean;
};

const toFiles: (ccc: ClassicCodeChallenge, opts?: Options) => FileWithSource[];

Supported Languages

  • C#
  • Dart
  • Java
  • JavaScript
  • Python
  • Ruby
  • TypeScript

Usage

import { toFiles } from "@qualified/ccc-files";

const preloaded = `
package example;

public class Preloaded {}
`;
const solution = `
package example;

public class Example {}
`;
const tests = `
package example;

class ExampleTests {}
`;

toFiles({
  preloaded,
  solution,
  tests,
  language: "java",
  languageVersion: "17",
  testFramework: "junit",
});
[
  {
    path: "src/test/java/example/ExampleTests.java",
    contents: "...",
    source: "tests",
  },
  {
    path: "src/main/java/example/Example.java",
    contents: "...",
    source: "solution",
  },
  {
    path: "src/main/java/example/Preloaded.java",
    contents: "...",
    source: "preloaded",
  },
];

FAQs

Package last updated on 20 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc