declaration-update
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Declaration Update

===

NPM version Downloads Minified size Gzip size

update object using mongodb way

👷 Still Working.

Setup via NPM

npm install declaration-update --save

This is a declaration for update a object in Javascript.

// import update from 'react-addons-update';
import { query } from 'declaration-update';
 
let testStores = {
    _id: 1,
    fruits: [ "apples", "pears", "oranges", "grapes", "bananas" ],
    vegetables: [ "carrots", "celery", "squash", "carrots" ]
}
const change = query(
    testStores,
    {},
    { $pull: { fruits: { $in: [ "apples", "oranges" ] }, vegetables: "carrots" } }
);
console.log(testStores, change)
/*
testStores: {
    "_id" : 1,
    "fruits" : [ "pears", "grapes", "bananas" ],
    "vegetables" : [ "celery", "squash" ]
}
change: [{op: "$pull", key: "vegetables", value: ["carrots", "carrots"]}]
*/

Readme

Keywords

none

Package Sidebar

Install

npm i declaration-update

Weekly Downloads

365

Version

0.0.2

License

ISC

Unpacked Size

80.5 kB

Total Files

36

Last publish

Collaborators

  • lwyj123