New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@kccd/nkc-utils

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kccd/nkc-utils

Utility helpers with separate browser and Node.js entry behavior.

latest
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

nkc-utils

A small utility library with separate browser and Node.js entry behavior.

Installation

npm install nkc-utils

Usage

Browser / universal usage

import { pureJsMethod, sharedUtil, nodeOnlyMethod } from "nkc-utils";

console.log(pureJsMethod("world"));
console.log(sharedUtil(1, 2));

try {
  nodeOnlyMethod();
} catch (error) {
  console.error(error);
}

Node.js usage

import { pureJsMethod, sharedUtil, nodeOnlyMethod } from "nkc-utils";

console.log(pureJsMethod("world"));
console.log(sharedUtil(1, 2));

const result = await nodeOnlyMethod("./example.txt");
console.log(result);

API

pureJsMethod(name: string): string

Returns a greeting string.

sharedUtil(a: number, b: number): number

Returns the sum of two numbers.

nodeOnlyMethod(...)

  • In Node.js: reads a file and returns a success message
  • In the browser: throws an error to indicate the API is not available there

Package behavior

This package uses conditional exports:

  • Node.js gets the Node-specific build
  • Browser environments get the browser-safe build by default

Development

npm install
npm run build

FAQs

Package last updated on 03 Apr 2026

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