Auto COMMIT for build : 76 \n commit by: Administrator <gitlab_admin_873017@example.com> \n with message : remove sudo

This commit is contained in:
GitLab Runner 2025-04-07 16:54:54 +02:00
commit 18bd65bae2
3 changed files with 63 additions and 0 deletions

30
README.md Normal file
View File

@ -0,0 +1,30 @@
# @D3v4pp/dot
[![GitHub license](https://img.shields.io/badge/licence-d3v4pp-red.svg)](https://cvs.d3v4pp.fr/D3V4PP/validate.git)
[![npm version](https://img.shields.io/npm/v/@d3v4pp/validate?style=flat)](https://www.npmjs.com/package/@d3v4pp/validate)
Get and set object properties with dot notation
## Installation
$ npm install @d3v4pp/dot
## API
### dot.set(object, path, value)
```js
dot.set(obj, 'cool.aid', 'rocks');
assert(obj.cool.aid === 'rocks');
```
### dot.get(object, path)
```js
var value = dot.get(obj, 'cool.aid');
assert(value === 'rocks');
```
### dot.delete(object, path)
```js
var value = dot.delete(obj, 'cool.aid');
assert(!obj.cool.hasOwnProperty('aid'));
```

1
index.js Normal file
View File

@ -0,0 +1 @@
(()=>{var r={};(()=>{var t=r;function e(r,t){return function(r){return"[object Object]"===Object.prototype.toString.call(r)}(r)?void 0===r[t]||function(r,t){return Object.prototype.hasOwnProperty.call(r,t)}(r,t):!!Array.isArray(r)&&!isNaN(parseInt(t,10))}t.set=function(r,t,n){for(var o=t.split("."),i=o.pop(),a=r,p=0;p<o.length;p++){var u=o[p];if(!e(r,u))return a;r[u]=r[u]||{},r=r[u]}return e(r,i)&&(r[i]=n),a},t.get=function(r,t){for(var e=t.split("."),n=e.pop(),o=0;o<e.length;o++){var i=e[o];if(!r[i])return;r=r[i]}return r[n]},t.delete=function(r,t){for(var n=t.split("."),o=n.pop(),i=0;i<n.length;i++){var a=n[i];if(!r[a])return;if(!e(r,a))return;r=r[a]}e(r,o)&&(Array.isArray(r)?r.splice(o,1):delete r[o])}})();var t=exports;for(var e in r)t[e]=r[e];r.__esModule&&Object.defineProperty(t,"__esModule",{value:!0})})();

32
package.json Normal file
View File

@ -0,0 +1,32 @@
{
"name": "@d3v4pp/dot",
"publishConfig": {
"access": "public"
},
"version": "0.0.2",
"description": "Get, set and delete object properties with dot notation",
"main": "index.js",
"author": {
"name": "Ayoub Hassani <D3v4pp>",
"email": "ayoub@d3v4pp.fr",
"url": "https://d3v4pp.fr/"
},
"funding": "https://paypal.me/SupportTheDoc",
"homepage": "https://cvs.d3v4pp.fr/D3V4PP/dot/src/master/README.md",
"bugs": {
"url": "https://cvs.d3v4pp.fr/D3V4PP/dot/issues",
"email": "ayoub@d3v4pp.fr"
},
"repository": {
"type": "git",
"url": "https://cvs.d3v4pp.fr/D3V4PP/dot.git"
},
"license": "d3v4pp",
"keywords": [
"dot",
"notation",
"properties",
"object",
"path"
]
}