New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cycni

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

cycni

Collection manipulation tool.

  • 1.1.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-80.95%
Maintainers
1
Weekly downloads
 
Created
Source

Cycni

A Collection manipulation tool

Warning Experimental

Cycni is a collection manipulation tool. It enables the ability to get, set, remove, and interact with an infinite depth collection. It provides an interface/api to manipulate objects, arrays, and others (coming soon) in a seamless and consistent method.

More examples coming soon see the test directory more examples.

Install

  • npm install cycni --save
  • UMD dist/cycni.js
  • ESM import src/cycni.b.m.js

Api

Cycni.get

  • collection Object, Array (Infinitely nested and combinations)
  • path String, Array key names to destination on object or array

Cycni.set

  • collection Object, Array infinitely nested and combinations
  • path String, Array key names to destination on object or array to be assigned
  • value Any the value to assign

Cycni.has

  • collection Object, Array infinitely nested and combinations
  • path String, Array key names to destination on object or array to compare values
  • value Function, RegExp, Any the value to compare to the destination returns a boolean

Cycni.remove

  • collection Object, Array infinitely nested and combinations
  • path String, Array key names to destination on object or array to be removed

Cycni.traverse

  • collection Object, Array infinitely nested and combinations
  • path String, Array key names to destination on object or array to be removed
  • callback Function arguments are the collection and key of the destination

Cycni.clone

  • variable Any clones Object, Array, Date or returns the value of any another

Examples

Collection

var collection = {
	id: '0',
	name: 'Cake',
	batters: [{
		id: '0',
		type: 'Regular'
	}, {
		id: '1',
		type: 'Chocolate'
	}, {
		id: 'u',
		type: 'Blueberry'
	}],
	hello: ['bob']
};

Remove


var results = Cycni.remove(collection, 'batters.0');

console.log(collection);
/*
{ id: '0',
  name: 'Cake',
  batters:
   [ { id: '1', type: 'Chocolate' },
     { id: 'u', type: 'Blueberry' } ],
  hello: [ 'bob' ] }
*/

console.log(results);
/*
{ id: '0', type: 'Regular' }
*/

Keywords

FAQs

Package last updated on 28 Mar 2017

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