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

object-array-property

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

object-array-property

Object helper. Property array manipulation.

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

object-array-property

Object helper. Property array manipulation. Creates, added items, deleted items, and more from an object property.

Install

Install with npm:

$ npm i --save object-array-property

Usage example

import {OpAdd, OpGet, OpRemove, OpDestroy} from "object-array-property";

const test = {};

OpAdd(test, "prop", 1);
OpAdd(test, "prop", 1);
OpAdd(test, "prop", 2);
console.log(test);
// >> {'prop':[1,2]}

OpRemove(test, "prop", 2);
console.log(test);
// >> {'prop':[1]}

OpDestroy(test, "prop");
console.log(test);
// >> {}

OpAdd(test, "logs", 1, 2, 3, 4, 5);
console.log(test);
// >> {'logs':[1,2,3,4,5]}

const logs = OpGet(test, "logs", true);
console.log('test:', test);
console.log('logs:', logs);
// >> test: {}
// >> logs: [1,2,3,4,5]

Library components and functions

FunctionDescription
OpTest(object, name): BooleanChecks that the object property name exists and is an array.
OpGet(object, name, destroy = false): ArrayGets the name property of the object or creates an empty array and returns it.
OpDestroy(object, name): objectDeletes the property name from object.
OpIncludes(object, name, value): BooleanChecks that the value is included in the array.
OpAdd(object, name, value, [value_2, ...value_n]): objectAdds (pushes) the new value element(s) to the array.
OpRemove(object, name, value, [value_2, ...value_n]): objectRemove all value element(s) from array.
OpLength(object, name): NumberGets array length.
OpCopy(object, name): ArrayCopies array.

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