How to use the dot-prop.get.bind function in dot-prop

To help you get started, we’ve selected a few dot-prop examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github derhuerst / flightradar24-client / lib / flight.js View on Github external
.then((d) => {
		const p = getProp.bind(null, d)
		const orig = getProp.bind(null, p('airport.origin') || {})
		const dest = getProp.bind(null, p('airport.destination') || {})
		const time = getProp.bind(null, p('time') || {})

		let dep = time('real.departure') || time('estimated.departure') || time('scheduled.departure')
		if (dep) dep = moment.tz(dep * 1000, orig('timezone.name')).format()
		let sDep = time('scheduled.departure')
		if (sDep) sDep = moment.tz(sDep * 1000, orig('timezone.name')).format()

		let arr = time('real.arrival') || time('estimated.arrival') || time('scheduled.arrival')
		if (arr) arr = moment.tz(arr * 1000, dest('timezone.name')).format()
		let sArr = time('scheduled.arrival')
		if (sArr) sArr = moment.tz(sArr * 1000, dest('timezone.name')).format()

		let delay = time('historical.delay') || null
		if (delay) delay = parseInt(time('historical.delay'))

		return {
github derhuerst / flightradar24-client / lib / flight.js View on Github external
.then((d) => {
		const p = getProp.bind(null, d)
		const orig = getProp.bind(null, p('airport.origin') || {})
		const dest = getProp.bind(null, p('airport.destination') || {})
		const time = getProp.bind(null, p('time') || {})

		let dep = time('real.departure') || time('estimated.departure') || time('scheduled.departure')
		if (dep) dep = moment.tz(dep * 1000, orig('timezone.name')).format()
		let sDep = time('scheduled.departure')
		if (sDep) sDep = moment.tz(sDep * 1000, orig('timezone.name')).format()

		let arr = time('real.arrival') || time('estimated.arrival') || time('scheduled.arrival')
		if (arr) arr = moment.tz(arr * 1000, dest('timezone.name')).format()
		let sArr = time('scheduled.arrival')
		if (sArr) sArr = moment.tz(sArr * 1000, dest('timezone.name')).format()

		let delay = time('historical.delay') || null
		if (delay) delay = parseInt(time('historical.delay'))

		return {
			id: p('identification.id'),
github derhuerst / flightradar24-client / lib / flight.js View on Github external
.then((d) => {
		const p = getProp.bind(null, d)
		const orig = getProp.bind(null, p('airport.origin') || {})
		const dest = getProp.bind(null, p('airport.destination') || {})
		const time = getProp.bind(null, p('time') || {})

		let dep = time('real.departure') || time('estimated.departure') || time('scheduled.departure')
		if (dep) dep = moment.tz(dep * 1000, orig('timezone.name')).format()
		let sDep = time('scheduled.departure')
		if (sDep) sDep = moment.tz(sDep * 1000, orig('timezone.name')).format()

		let arr = time('real.arrival') || time('estimated.arrival') || time('scheduled.arrival')
		if (arr) arr = moment.tz(arr * 1000, dest('timezone.name')).format()
		let sArr = time('scheduled.arrival')
		if (sArr) sArr = moment.tz(sArr * 1000, dest('timezone.name')).format()

		let delay = time('historical.delay') || null
		if (delay) delay = parseInt(time('historical.delay'))
github derhuerst / flightradar24-client / lib / flight.js View on Github external
.then((d) => {
		const p = getProp.bind(null, d)
		const orig = getProp.bind(null, p('airport.origin') || {})
		const dest = getProp.bind(null, p('airport.destination') || {})
		const time = getProp.bind(null, p('time') || {})

		let dep = time('real.departure') || time('estimated.departure') || time('scheduled.departure')
		if (dep) dep = moment.tz(dep * 1000, orig('timezone.name')).format()
		let sDep = time('scheduled.departure')
		if (sDep) sDep = moment.tz(sDep * 1000, orig('timezone.name')).format()

		let arr = time('real.arrival') || time('estimated.arrival') || time('scheduled.arrival')
		if (arr) arr = moment.tz(arr * 1000, dest('timezone.name')).format()
		let sArr = time('scheduled.arrival')
		if (sArr) sArr = moment.tz(sArr * 1000, dest('timezone.name')).format()

		let delay = time('historical.delay') || null
		if (delay) delay = parseInt(time('historical.delay'))

dot-prop

Get, set, or delete a property from a nested object using a dot path

MIT
Latest version published 10 months ago

Package Health Score

80 / 100
Full package analysis