You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

o

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

o

common object helper functions

2.3.2
latest
Source
npmnpm
Version published
Weekly downloads
6.5K
-30.89%
Maintainers
1
Weekly downloads
 
Created
Source

o Logo

o

common object helper functions written in TypeScript which can be used in NodeJS and the browser (supports ES6).

GitHub Actions Status Coverage Status npm version license JavaScript Style Guide

Installation

NPM

$ npm install o

Yarn

$ yarn add o

Usage

TypeScript

import o from 'o';
// or require specific functions
import { is, empty } from 'o';

NodeJS

const o = require('o');
// or require specific functions
const { is, empty } = require('o');

Browser

ES6
<!-- Script tag -->
<script
  type="module"
  src="./o.min.js"
/>

<!-- Import syntax -->
<script type="text/javascript">
  import './o.min.js';
</script>
CDN/Script
<script
  type="application/javascript"
  src="https://cdn.jsdelivr.net/npm/o@2.0.0/dist/o.min.js"
/>

Example usage

const a = {
  a: 1,
  b: 2,
  c: {
    d: 3,
    e: 4,
  },
};

is(a); // => true
empty(a); // => false
has(a, 'a'); // => true
has(a, 'd'); // => false
has(a, 'c.d'); // => true

const b = set(a, 'f', 5);
get(b, 'f'); // => 5

For more examples and a list of all functions view the documentation page.

Documentation

You can view the documentation here, docs are generated by TypeDoc.

Contributing

All functions are documented with TypeDoc and are fully commented explaining how they works. If you want to contribute feel free to open a PR. When you open a PR please make sure yarn test and yarn lint both pass with no errors and if any tests fail or any linting issues are raised please fix them accordingly.

Keywords

object

FAQs

Package last updated on 21 Nov 2019

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.