1.0.3 • Published 4 years ago

laravel-js-helpers v1.0.3

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

Travis npm license PRs Welcome dependencies npm version HitCount Open Source Love svg1 Maintenance


Laravel JS Helpers


"Laravel Helper Methods In Javascript"


Installation

NPM

npm install --save-dev laravel-js-helpers

Yarn

yarn add laravel-js-helpers --save

CDN

<script src='https://unpkg.com/laravel-js-helpers@latest/build/index.min.js'></script>

Playground Examples


Curious, but not 100% on whether this is what you're looking for?


Utilization



Data Get


Data Get Simple

data_get(family, 'family.members.brother.name');

Data Get Output

"drew"

Data Get Wildcard("*")

data_get(family, 'family.members.*.age'); 

Data Get Wildcard Output

[17, 25, 'thats not polite', 50];

Data Set


Data Set Simple

data_set(family, 'members.brother.age', 21);
data_set(family, 'members.brother.name', 'Everett');

Data Set Wildcard("*")

data_set(family, 'members.*.last_name', 'Smith');

Data Set Output

{
	members: {
		brother: {
			age: 21,
			name: 'Everett',
			last_name: 'Smith',
			hobbies: ['football', '"chillin"', 'video games']
		},
		sister: {
			age: 25,
			name: 'ash',
			last_name: 'Smith',
			hobbies: ['mothering babies', 'fitness', 'nutrition', '']
		},
		mother: {
			name: 'amy',
			last_name: 'Smith',
			age: 'thats not polite',
			hobbies: ['cleaning', 'nursing', 'hiking']
		},
		father: {
			age: 50,
			name: 'jon',
			last_name: 'Smith',
			hobbies: ['reading', 'sports', 'talking for seemingly ever', 'providing useful insights']
		},
	}
}

Data Fill


Data Fill Simple

data_fill(family, 'members.brother.age', 23); // wont do anything
data_fill(family, 'members.brother.name', 'Zak'); // wont do anything
data_fill(family, 'members.brother.birthday', 'April 22'); // will do something

Data Fill Wildcard("*")

data_fill(family, 'members.*.last_name', 'Horton'); // wont do anything
data_fill(family, 'members.*.nickname', 'Hortonion'); // will do something

Data Fill Output

{
	members: {
		brother: {
			age: 21,
			name: 'Everett',
			last_name: 'Smith',
			birthday: 'April 22',
			nickname: 'Hortonion',
			hobbies: ['football', '"chillin"', 'video games']
		},
		sister: {
			age: 25,
			name: 'ash',
			last_name: 'Smith',
			nickname: 'Hortonion',
			hobbies: ['mothering babies', 'fitness', 'nutrition', '']
		},
		mother: {
			name: 'amy',
			last_name: 'Smith',
			nickname: 'Hortonion',
			age: 'thats not polite',
			hobbies: ['cleaning', 'nursing', 'hiking']
		},
		father: {
			age: 50,
			name: 'jon',
			last_name: 'Smith',
			nickname: 'Hortonion',
			hobbies: ['reading', 'sports', 'talking for seemingly ever', 'providing useful insights']
		},
	}
}

Contribute


PRs are welcomed to this project. If you want to improve the laravel-js-helpers library, add functionality or improve the docs please feel free to submit a PR.


Security Vulnerabilities


If you discover a security vulnerability within Clean Code Studio Packages Or Specifically within laravel-js-helpers, please send an e-mail to Zachary Horton via zak@cleancode.studio. All security vulnerabilities will be promptly addressed.


Change Log


Release 1.0.3


  • CDN
  • Tests
  • Change Log
  • Documentation
  • Travis Continuous Build Integration

Release 1.0.2


  • data_get
  • data_set
  • data_fill
  • transform
  • value
  • blank
  • filled
  • collect

Release 1.0.1


  • Initial Simple Documentation Setup

Release 1.0.0


  • Initial Setup

Versioning


Semantic Versioning

Code StatusStageRuleExample Version
First releaseNew ProductStart with 1.0.01.0.0
Backward compatible bug fixesPatch ReleaseIncrement the third digit1.0.1
Backward compatible new featuresMinor ReleaseIncrement the middle digit and reset last digit to zero1.1.0
Changes that break backward compatibilityMajor ReleaseIncrement the first digit and reset middle and last digits to zero2.0.0

License


MIT © Zachary Horton (Clean Code Studio)