šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

jsprim

Package Overview
Dependencies
Maintainers
14
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsprim

utilities for primitive JavaScript types

1.4.2
Source
npm
Version published
Weekly downloads
21M
5.48%
Maintainers
14
Weekly downloads
Ā 
Created

What is jsprim?

The jsprim package provides utilities for working with primitive JavaScript types. It includes functions for deep copying, testing object types, parsing JSON safely, and more. It's designed to offer a collection of utilities that are commonly needed but not provided by the JavaScript standard library.

What are jsprim's main functionalities?

Deep copying objects

This feature allows you to create a deep copy of an object, ensuring that nested objects are also copied rather than just copying the reference.

var jsprim = require('jsprim');
var obj = { a: 1, b: { c: 2 } };
var copy = jsprim.deepCopy(obj);

Checking if a value is an object

This utility helps in determining whether a given value is an object, which can be particularly useful for validation and type checking.

var jsprim = require('jsprim');
var result = jsprim.isObject({}); // true
result = jsprim.isObject(123); // false

Parsing JSON safely

Safely parse a JSON string, catching any errors that occur during parsing and returning `null` instead of throwing an exception.

var jsprim = require('jsprim');
var str = '{ "key": "value" }';
var obj = jsprim.parseJSON(str);

Other packages similar to jsprim

FAQs

Package last updated on 29 Nov 2021

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