ObjectPath – ObjectPath https://objectpath.org Fri, 08 Nov 2024 02:08:52 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.1 https://objectpath.org/wp-content/uploads/2022/12/cropped-Object-Path-Logo-32x32.jpg ObjectPath – ObjectPath https://objectpath.org 32 32 v2.5.1 Foxiz – WordPress Newspaper News and Magazine [Free Download] GPL https://objectpath.org/foxiz-wordpress-newspaper-news-and-magazine-free-download-gpl/ Wed, 14 Dec 2022 00:53:04 +0000 https://objectpath.org/?p=1350

Foxiz nulled is a WordPress theme perfect for news, magazine, blog and for all kinds of publishing websites. It has all the tools for every publishing need, easy to use for blogging, fashion, food, beauty, technology, gadget, hardware, lifestyle, modern, personal, travel, viral, architecture, game, minimal, video, cryptocurrency, podcast and more websites.

This theme supports Elementor, dark mode, AMP, RTL, multi languages, paywall, membership, GDPR compliant. SEO friendly with schema structure for organization, site links search box, breadcrumbs bar. Support Open Graph, compatible with Yoast, All in One and Rank Math SEO plugins… That will make search engines love your website.

Prioritizing design for mobiles and fully responsive. Optimized for the speed, lightweight and ready for core web vitals.

We have a lot of positive feedback from our buyers on the marketplace. We are committed to providing the best support and solving almost all issues within 24 hours.

Foxiz theme nulled is very flexible with more than 1000+ options, allowing you the ability to create anything without any coding.

The theme is compatible and optimized to work with Elementor, Contact Form 7, Super Cache, Rank math SEO, W3 Total Cache, Yoast SEO, All in One Seo, WP-Optimize, Autoptimize and many other popular WordPress plugins.

https://themeforest.net/item/foxiz-wordpress-newspaper-and-magazine/34617430

Foxiz – WordPress Newspaper News and Magazine has published on 29 March 2022 for the first time by Theme-Ruby and the last update was on 10 December 2022. It has sold 1,516 copies with a $59 price tag. 83 customers voted and the average was 4.98 stars / 5. 

Foxiz – WordPress Theme Demo Install and Setup

YouTube player

Changelog

Version 2.5.1 – 7 Nov 2024

  • Added popup (lightbox) block that allows popup content creation via Ruby Template.
  • Fixed single audio post issue in version 2.5.0
  • Minor improvements and bug fixes.

Version 2.5.0 – 29 Oct 2024

  • Added front-end submission plugin with form settings, user post management, and much more.
  • Added a new trendy design.
  • Added table of contents font settings.
  • Added single pagination font settings.
  • Added BlueSky social media.
  • Added verification icon to the author box.
  • Added support for selecting the default crop size for WordPress core in all blocks.
  • Added an increased tag cloud limit to allow up to 100 tags.
  • Improved overall PHP logic and optimized loading file codes to increase speed, enhance security, and reduce CPU, memory usage.
  • Improved the overall Foxiz dashboard, allowing management of all theme features and options in one place.
  • Improved overall JavaScript code to comply with Privacy Sandbox policies of browsers.
  • Improved the overall demo importer, allowing cleanup of the importer and facilitating a fresh installation.
  • Improved translation support, enabling quick string searches.
  • Improved the WPML configuration file.
  • Improved search functionality in the theme options.
  • Improved outdated WooCommerce template notice.
  • Improved CSS styling issues.
  • Improved update Google Fonts.
  • A ton of improvements and other bug fixes.
]]>
v30.8.1 Bridge WordPress Theme Free Download [Activated] https://objectpath.org/bridge-wordpress-theme-free-download/ Wed, 14 Dec 2022 09:22:48 +0000 https://objectpath.org/?p=1366

BRIDGE is a responsive retina multipurpose WordPress theme perfect for just about anyone. Whether you are a creative, a corporate team, a lawyer, a medical doctor or a freelancer looking for a modern portfolio website or a personal blog, Bridge WordPress theme nulled is your best option.

Build with WPBakery, Gutenberg or Elementor – it’s your choice!

Need a 1-page gallery, a coming soon or an app landing page? Own a restaurant, a bar or a pizza parlor? A gym or a fitness studio? You have a wellness or a spa center, or promote healthy lifestyle? We got you! Bridge is here if you need a superb website for your hotel, travel tour, church, wedding, shop, seo digital marketing agency, or if you are into photography, architecture, fashion, design, organic food, music or offer any type of service out there. Bridge is not just a theme, it’s a collection of amazing examples with tons of features. The possibilities are truly endless.

Bridge comes with bundled plugins. For details on how bundled plugins work, please refer to this article: https://help.market.envato.com/hc/en-us/articles/213762463-Bundled-Plugins

YITH WooCommerce Quick View & YITH WooCommerce Wishlist plugin compatibility – Thanks to the YITH WooCommerce Quick View the website visitors can easily check out the offered items and view product details with just a single mouse click. YITH WooCommerce Wishlist, on the other hand, enables them to check the product availability and to add items to their wishlist.

https://themeforest.net/item/bridge-creative-multipurpose-wordpress-theme/7315054

Bridge – Creative Multipurpose WordPress Theme has published on 3 April 2014 for the first time by QODE and the last update was on 4 November 2022. It has sold 193,233 copies with a $69 price tag. 6.6K customers voted and the average was 4.78 stars / 5. 

CHANGELOG

Version 30.8.1 – October 10th, 2024

– Fixed potential XSS vulnerability for Bridge Import
– Updated Bridge Core to 3.3.1

Version 30.7 – September 10th, 2024

– Added WooCommerce 9.2+ compatibility
– Updated WPBakery page builder to 7.9
– Updated Revolution Slider to 6.7.18
– Updated LayerSlider to 7.12.3

VERSION 30.6.1 – JULY 18TH, 2024

– Updated Qode Membership plugin to 2.0.5
– Updated Qode WooCommerce Checkout Integration to 2.0.3
– Updated Qode LMS to 3.1.1
– Fixed potential Google Maps problem
– Fixed error with WooCommerce block cart when Course or Real Estate Pricing Package is added to cart

VERSION 30.6 – JULY 2ND, 2024

– Added WooCommerce 9.0.0 compatibility
– Added FontAwesome Twitter X and TikTok icons for Social Icon widget
– Updated Bridge Core to 3.2.0
– Updated Qode Music to 2.1.7
– Updated Qode LMS to 3.1.0
– Updated Qode Membership to 2.0.4
– Updated WPBakery page builder to 7.7.2
– Updated Revolution Slider to 6.7.14
– Updated Timetable Responsive Schedule For WordPress to 7.3
– Fixed google maps and ‘fluidvids’ plugins script dependencies for Qode Music plugin
– Fixed PHP warning in Performance module
– Improved Course price rendering ( discount price is included )
– Improved membership login redirection when logging in on Course single page

YouTube player
]]>
v7.6.4 Alone Charity Theme Free Download https://objectpath.org/alone-charity-theme-free-download/ Thu, 15 Dec 2022 03:01:35 +0000 https://objectpath.org/?p=1372

ALONE Charity Theme Nulled 7.0 is live!
Compatible with WordPress 6.x. Alone always keeps bundled plugins up-to-date to improve your website with new features.

ALONE – Powerful and flexible WordPress theme that comes with 39+ unique and stunning demos, suitable for all your idea and different types of Non-profit Organizations, Ngo, Church, Events, Political, Candidate, Campaign project

Your non-profit project will start getting money and move your activities to much higher level. Good luck with donations and fundraising.

https://themeforest.net/item/alone-charity-multipurpose-nonprofit-wordpress-theme/15019939

Alone – Charity Multipurpose Non-profit WordPress Theme has published on 11 March 2016 for the first time by Bearsthemes and the last update was on 18 November 2022. It has sold 7,326 copies with a $59 price tag. 432 customers voted and the average was 4.78 stars / 5. 

Changelog

ALONE 7.x is live!

]]>
v3.4.1 Streamit Video Streaming WordPress Theme Free Download [GPL, Activated] https://objectpath.org/streamit-video-streaming-wordpress-theme-free-download-gpl/ Wed, 14 Dec 2022 09:06:50 +0000 https://objectpath.org/?p=1364

Create an OTT website similar to Netflix, Amazon Prime or YouTube with Streamit

Feature-Rich Video Streaming Template

Streamit is a powerful WordPress theme for OTT Streaming platforms. It is a sleek and clean-looking Theme. With some unique features and stunning UI/UX elements, the StreamIt template is a perfect package for any media or video, movie, show streaming-related web application.

It has beautiful front-end pages, a fully functional admin panel, a rating list, and a user list. You can add movies as well as shows on Streamit. You’ll get a ready-to-use login page and pricing page. It is an extremely functional and easy steering feature. Streamit is perfectly apt for creating video blogs, video tutorial sites, and podcasts. Your Streamit is a responsive website and is fully adaptive.

Different Use Case of Streamit

Streamit WordPress theme nulled comes with an appealing demo page and offers you to build an online Movies Magazine, TV Show and Video streaming website, video blog or vlog site, or events streaming site. Explore all possibilities with a stunning Streamit.

5 Powerful Reasons To Buy Streamit

  • Restricted Pages/Content – You can restrict access to your video streaming site pages or the entire site with the built-in content restriction tools.
  • Watchlist – Your users can add videos to their watchlist by signing up/in.
  • Video Rating Feature– Users can add ratings on your video streaming build using Streamit.
  • Advanced Search – Streamit includes a custom search engine that lets users easily find videos.
  • Five-star Support – Get the most reliable and fast support by opening a support ticket at https://iqonic.desky.support/

What benefits do you get?

We’ve added ready-to-use pages for video stream applications like Netflix, Sonyliv, Voot. The template’s harmonious design and super clean looks will make your web app look beautiful and elegant. This template works seamlessly on all major web browsers, tablets, and phones.

Every page is fully responsive and retina-ready, making your creation look good on any device.

Changelog

Notes: Before update Latest version First need required changes.
Update streamit Note highlight: header menu change slug Movies -> movie , Tv-shows -> tv-show, Videos -> video

Version 3.4.1 – 12th February 2024

[Updated] – Compatibility with Latest WordPress (6.4.3).

[Fixed] – Minor Bugs fixed.

https://themeforest.net/item/streamit-video-streaming-wordpress-theme/29772881

Streamit 2.0 | Video Streaming WordPress Theme + RTL has published on 24 December 2020 for the first time by iqonicdesign and the last update was on 21 October 2022. It has sold 1,291 copies with a $59 price tag. 50 customers voted and the average was 4.76 stars / 5. 

YouTube player

Changelog

v3.3.2 (23.04.2024)

- Updated: Bundled plugins to the latest version;
- Added: Custom header and footer options for inner pages;
- Added: Hide "All" item option for gallery filter in "Gallery" widget;
- Fix: Minor improvements and fixes.

v3.3.1 (05.04.2024)

- Updated: Bundled plugins to the latest version;
- Fix: Minor improvements and fixes.

v3.3.0 (12.03.2024)

- Updated: Bundled plugins to the latest version;
- Added: New Apartment Hotel Demo;
- Fix: Minor improvements and fixes.
]]>
Tutorial Start using ObjectPath’s interactive shell in no time https://objectpath.org/tutoria/ https://objectpath.org/tutoria/#respond Thu, 01 Dec 2022 13:55:14 +0000 https://objectpath.org/?p=905 Warning! WORK IN PROGRESS!
This tutorial is a stub. If you’d like to help writing it, fork ObjectPath on Github and submit a pull request.

We’ll work with the following JSON document:

{
	"store": {
		"book": [
			{
				"category": "reference",
				"author": "Nigel Rees",
				"title": "Sayings of the Century",
				"price": 8.95
			},
			{ 
				"category": "fiction",
				"author": "Evelyn Waugh",
				"title": "Sword of Honour",
				"price": 12.99
			},
			{ 
				"category": "fiction",
				"author": "Herman Melville",
				"title": "Moby Dick",
				"isbn": "0-553-21311-3",
				"price": 8.99
			},
			{ 
				"category": "fiction",
				"author": "J. R. R. Tolkien",
				"title": "The Lord of the Rings",
				"isbn": "0-395-19395-8",
				"price": 22.99
			}
		]
	}
}

Installing and running

Python

Install the newest version from GitHub:

$ git clone https://github.com/adriank/ObjectPath.git
$ cd ObjectPath
$ python shell -h
usage: shell [-h] [-u URL] [-xml] [-d] [FILE]

Command line options

positional arguments:
	FILE               File name

optional arguments:
	-h, --help         show this help message and exit
	-u URL, --url URL  URL containing JSON document.
	-xml               [EXPERIMENTAL] Expect XML input.
	-d, --debug        Debbuging on/off.

To use localization features you need python-tz package installed on your machine.

You can also run ObjectPath in PyPy, the faster Python implementation:

pypy objectpath

Heads up! You can try ObjectPath without installing it on your box (though with limited functionality!). Open a developer console of your choice (right click here and click inspect element, then console) and use ObjectPath JavaScript implementation to test the language . Just write:

op.exe("2+2")

Basics

Before getting your hands dirty read through the language basics, even if you’re an experienced programmer – some sugar can be found here.

Basic arithmetics

ObjectPath supports common arithmetics:

  • addition (+)
  • subtraction (-)
  • multiplication (*)
  • division (/)
2+2*2 -> 6
(2+2)*2 -> 8
8/5 -> 1.6 
17 % 3 -> 2 #remainder of division

Working with strings

ObjectPath provides a range of tools to manipulate strings. Strings are written as:

"text" or 'text'

Strings can be concatenated by + sign:

"Hello "+"World!" -> "Hello World!"

Numbers can be concatenated with strings if string is on the left-hand side of + sign

"Hello "+2+"!" -> "Hello 2!"
2+" Hello!" -> error (in JS you'll see NaN, which is a bug)
""+2+" Hello!" -> "2 Hello!"

In the Python version of ObjectPath it’s also possible to do some crazy things like:

3*"a" -> "aaa"
"Hello %s"%"World!" -> "Hello World!"

To access specific parts of the string, use the following:

# To get the first character of the string
"Hello World!"[0] -> "H" # We count letters starting from 0!
# To get the last character of a string:
"Hello World!"[-1] -> "!"
# To get the substring "Word"
slice("Hello World!",[6,11]) -> "World"
# or in the Javascript version:
"Hello World!"[6:11] -> "World"

ObjectPath also offers a vast range of functions that can do the following tricks on strings (currently available only in the Python version):

len("Hello") -> 5
upper("Hello") -> "HELLO"
lower("Hello") -> "hello"
title("Hello world") -> "Hello World"
capitalize("hello world") -> "Hello world"
split("hello world"," ") -> ["Hello","world"]
replace("hello world!","world","moon") -> "Hello moon!"
# replace can also take advantage of regular expressions
replace("hello world!","l[^l]","r") -> "Helr worr!"

Functions can be nested:

upper(replace("hello world!","world","moon")) -> "HELLO MOON!"

Simple queries

Putting the boring stuff aside we fast forward to queries. Simple queries starts with $ character. It indicates the root of the document. To show the whole document write:

$

ObjectPath is like paths to files in your operating system. . means we want to go one level deeper in JSON document (equivalent to / on Unix/Mac or \ on Windows in the paths to files).

$.store.book

This returns an array. You can select a specific element from it, filter etc:

$.store.book[1] # get the second book
$.store.book[-1] # get the last book
$.store.book[2:4] # get the 3rd and 4th book

We can also get specific elements based on their properties:

$.store.book[@.price is 0.99] # get books of price 0.99

@ points to the current element from books. In other words, [ iterates over the array of books and for each element checks if condition inside square parenthesis is met. @ tells ObjectPath that price is an property of each book, not a string.

To make it even more interesting we can filter it even further by getting only the specific fields from results:

$.store.book[@.price is 0.99].(price, isbn) # WARNING! works only in Python verion! filter attributes from the result

When we don’t know where in the document are prices, we can search for all of them by:

$..price # searches for any attribute named price in the document
$..price[@ > 0.99] # returns all prices greater than 0.99

In the last example we used @ to indicate current element of an array of prices.

]]>
https://objectpath.org/tutoria/feed/ 0
Reference Manual https://objectpath.org/reference/ https://objectpath.org/reference/#respond Thu, 01 Dec 2022 13:53:12 +0000 https://objectpath.org/?p=903 Use this page as a cheatsheet. If you are a new user we recommend you start with the tutorial (coming soon).

Implementation info

Heads Up! ObjectPath currently has two implementations, in Python and Javascript. The Python version is the reference implementation. Features supported by Javascript are indicated by . Python-specific features are indicated by

Warning! Javascript doesn’t support big integers at all. Keep it in mind and convert them to strings. Or just use the Python version instead.

Simple types

ObjectPath inherits all JSON data types and supports a few more.

  • number such as 100 or 2.333
  • string such as "string" or 'string'
  • null such as null
  • true such as true or t
  • false such as false or f

ObjectPath type rules:

  • number is split into integer and float:
    • integer is a fast and small integer number
    • float is a slow and very accurate real number
    Python implementation of ObjectPath tries to determine which one to use. Sometimes number is converted into Python’s long type. Javascript has one uniform number type (with limit on number size).
  • Strings are encoded in UTF-8,
  • Added the datetimedate and time types to handle dates and times,
  • Boolean types and null are case insensitive and can be written in several ways:
    • true can be written as: ttrue (or trUe),
    • false as: f or false,
    • null as: nnonenullnil.
  • Negative are: falsenull0""[]{}. Any other value is positive.

Complex types

Arrays can be defined in the language by issuing:

[ val1, val2, ..., valN]

and for objects it is:

{ "atr1":val1, "atr2":val2, ..., "atrN":valN }
{ atr1:val1, atr2:val2, ..., atrN:valN }
  • Attribute names can be dynamically created. Example: {$.myCar.model: "avg temperature is "
    + avg($.cars[@.model is $.myCar.model].temp)} -> {"Toyota Prius": "avg temperature is 4.5"}
  • When an expression returns a value other than string, it is casted to string. Example: {2+2:"4"} -> {"4":"4"}
  • Names can be written without quotes, but in that case they cannot start with an operator. ObjectPath raises an exception if name is not valid.

Dates and times

Dates are handled as datetime objects. There are also date and time objects which provide support for date and time manipulation. Datetimedate and time objects support yearmonthdayhourminutesecond and microsecond attributes eg. now().year -> 2011.

Operations on dates should be performed on UTC dates and then converted to local time in order to avoid locale and DST (daylight saving time) nuances.

Operators

How operators work

Operators take computation results from their left and right side and perform an operation on these results. While behaviour of simple operators is straightforward, operators such as ... and [] are more advanced.

Each of them works on arrays of objects on the left and apply to each element from this array the instruction found on the right. To better understand what it means, consider a document:

{
  "a":1,
  "b":{
    "c":[1,2,3]
  }
}

and path:

$.b.c[@ > 2]

It works internally like this:

>>> $
{
  "a":1,
  "b":{
    "c":[1,2,3]
  }
}
>>> $.b
{
  "c":[1,2,3]
}
>>> $.b.c
[1,2,3]
>>> $.b.c[@ > 2]
# left  | right          | result
# [     |                | [
#   1   | > 2 -> false   |   #nothing
#   2   | > 2 -> false   |   #nothing
#   3   | > 2 -> true    |   3
# ]     |                | ]
[3]

The result is always an array! because ObjectPath executes > for each element in the array and filters out elements that do not match the condition.

Operator precedence

Operations are executed in the following order:

(. = [ = () -> (+ (prefix) = - (prefix)) -> (* = /) -> (+ (infix) = - (infix)) -> (in = not = is = < = > = <= = >=) -> not -> and -> or

Other operators and tokens are precedence-neutral.

Arithmetic operators

OperatorDescriptionExampleNotesSupport
+addition2 + 3 -> 5+ is also a concatenation operator
-subtraction2 - 3 -> -1
*multiplication2 * 3 -> 6Alternative use is select all objects from array
/division2/3 -> 0.6666666666666666Integer division results in floating point number. Use int() built-in function to turn it into integer again.
%modulo10%3 -> 1

Boolean logic operators

OperatorDescriptionExampleNotesSupport
notnegationnot 3 -> falsenot always casts result to boolean type
andconjunctiontrue and false -> falseand evaluates expression on the left-hand side, if negative it is returned; expression on the right-hand side is not evaluated.
oralternationtrue or false -> trueor evaluates expression on the left-hand side, if positive it is returned; expression on the right-hand side is not evaluated.

Comparison operators

ObjectPath uses algorithms that guess types of data. In most cases you don’t need to worry about issues with types (e.g. comparing string “2” with number 2 works as if 2 was a string). To check if types are the same or different you can use type("2") is type(2) -> false.

In semi-structured data a very common issue is that the data are represented as a different type than it was supposed to be. For example very often we can see numbers represented as strings (like ["1", "2", "3"] instead of simply [1,2,3]). This is caused by automatic JSON generators, especially those that convert XML data into JSON. In programming languages such as Javascript this can cause many headashes and hours wasted figuring out why the code doesn’t work. That’s why:

Comparison operators try to cast the right-hand side expression result to the type of the left-hand side expression result. Sometimes it fails so best practice is to use casting functions when types might be different.

The comparison operators are not chainable so 1 < 2 < 2 will compare 2 with result of 1 < 2 which is true and return true. Use 1 < 2 and 2 < 3 instead.

OperatorDescriptionExampleNotesSupport
isequality'3' is 3 -> trueright expression result is casted to the type of left expression result and then compared
is notequality negation3 is not 3 -> false
>>=<<=grater than, grater than or equal, less than, less than or equal1 > 0 -> true

Membership tests

OperatorDescriptionExampleNotesSupport
inChecks if the result of the left side of expression is in arrayobject or string3 in [1,2,4] -> false,
"ia" in "Adrian" -> true
In objects, keys are matched.
not inOpposite behavior to in; Equivalent to not expr in array1 not in [1,2,3] -> false

Concatenation operator +

Besides standard addition of numbers, + concatenates strings, arrays and objects.

If two arrays are concatenated, right array elements are added to the end of the left array.

If string is concatenated with array, it is added to the beggining or end of array depending on the order:

Objects are merged so that right object overwrites existing elements of left object. Object concatenation is not deep. It means that only direct child elements of root element are overwritten rather than leaf nodes.

>>> [1, 2, 4] + [3, 5]
[1, 2, 4, 3, 5]
>>> "aaa"+["bbb"]
["aaa", "bbb"]
>>> ["bbb"]+"aaa"
["bbb", "aaa"]
>>> {"a":1, "b":2} + {"a":2, "c":3}
{"a":2, "b":2, "c":3}

Built-in functions

Casting functions

Casting is done by passing arguments to Python functions of the same name.

FunctionExampleNotesSupport
str(ANY)str(11) -> '11'
int(NUMBER/STRING)int(123.45) -> 123
float(NUMBER/STRING)float('123.45') -> 123.45
array(ANY)array(now()) -> [2011, 4, 8, 13, 3, 55, 747070]

Arithmetic functions

FunctionExampleNotesSupport
sum(ARRAY)sum([1, 2, 3, 4]) -> '10'Argument is a list of numbers. If there are float numbers in the list, sum() returns float.
max(ARRAY)max([2, 4, 1, 3]) -> 4
min(ARRAY)min([2, 4, 1, 3]) -> 1
avg(ARRAY)avg([2, 4, 1, 3]) -> 2.5Equivalent to sum(array)/len(array)
round(FLOATINTEGER)round(0.55, 1) -> 0.5Always returns float. Second argument defines the precision of round.

String functions

FunctionExampleNotesSupport
replace(STRINGtoReplacereplacement)replace('abcd','b','a') -> 'aacd'
escape(STRING)escape('<>&\'"') -> "&lt;&gt;&amp;&apos;&quot;"Converts HTML reserved characters to their HTML equivalents.
unescape(STRING)unescape("&lt;&gt;&amp;&apos;&quot;") -> '<>&\'"'Reverse to the escape.
upper(STRING)upper('AaA') -> 'AAA'
lower(STRING)lower('AaA') -> 'aaa'
capitalize(STRING)capitalize('AaA') -> 'Aaa'
title(STRING)title('aaa bbb') -> 'Aaa Bbb'
split(STRING <, sep>)split('aaa bbb') -> ['aaa', 'bbb'],
split('aaa,bbb','.') -> ['aaa', 'bbb']
slice(STRING, [startend]),
slice(STRING, [[startend], [start,end], ...])
slice('Hello world!', [0, 5]) -> 'Hello',
slice('Hello world!', [[0, 5], [6, 11]]) -> ["Hello", "world"]) -> ['aaa', 'bbb']
added in ObjectPath 0.5 read more

The slice() function (added in ObjectPath 0.5)

Extracts a section of a string and returns a new string. The usage is:

slice(string, [start, end])
slice(string, [[start, end], [start2, end2], ...])

The first argument is always a string. The second argument can be either an array of two numbers (start and end positions) or an array of arrays of two numbers (start and end position). If position is negative, then position is counted starting from the end of the string. Examples:

slice("Hello world!", [6, 11]) -> "world"
slice("Hello world!", [6, -1]) -> "world"
slice("Hello world!", [[0, 5], [6, 11]]) -> ["Hello", "world"]

Array functions

FunctionExampleNotesSupport
sort(ARRAY <, key>)sort(['c', 'b', 'a']) -> ['a', 'b', 'c'],
sort([{v:'c', x:1},{v:'b', x:2},{v:'a', x:3}], 'v') -> [{v:'a', x:3}, {v:'b', x:2}, {v:'c', x:1}]
If key is provided, will sort array of objects by key.
reverse(array)reverse([1,3,2,2,5]) -> [5,2,2,3,1] Reverse may be very slow for large data.
count(ARRAY)len(ARRAY)count([1, 2, 3]) -> 3Reverse to the escape.
join(ARRAY <, joiner>)join(['c', 'b', 'a']) -> 'cba',
join(['c', 'b', 'a'], '.') -> 'c.b.a'

Date and time functions

All date and time functions are manipulating datetime objects. The default (and the only!) timezone is UTC.

FunctionExampleNotesSupport
now()now() -> '2011-04-08 13:03:55.747070'Gets current UTC time.
date(arg)date() -> '2011-04-08',
date([2011, 4, 8]) -> '2011-04-08',
date(now()) -> '2011-04-08'
arg can be array of structure [yyyy,mm,dd] or datetime object . If no arg is specified then date() defaults to current UTC date.
time(arg)time() -> '13:03:55.747070',
time([13, 3, 55, 747070]) -> '13:03:55.747070',
time(now()) -> '13:03:55.747070'
arg can be array of structure [hh,mm,ss,mmmmmm] where only hour is required, or datetime object . If no arg is specified then time() defaults to current UTC time.
dateTime(args)dateTime(now()) -> '2011-04-08 13:03:55.747070',
dateTime([2011, 4, 8, 13, 3, 55, 747070]) -> '2011-04-08 13:03:55.747070',
dateTime(date(), time()) -> '2011-04-08 13:03:55.747070',
dateTime([2011, 4, 8], time()) -> '2011-04-08 13:03:55.747070'
args: if one argument is specified then it need to be datetime object or [yyyy, mm, dd, hh, mm, ss, mmmmmm] where yearmonthdayhour and minute are required. If two arguments are specified, the first argument can be date object or [yyyy, mm, dd] array, second can be time object or [hh, mm, ss, mmmmmm] array where only hour is required.
age(time)age(sometime) -> [1, 'week']Counts how old the provided time is and prettyprints it.
toMillis(time)Counts milliseconds since epoch.

Misc functions

FunctionExampleNotesSupport
type(ANY)type([1,3,2,5]) -> 'array'Tool helpful in debugging expressions.
count(any), len(any)count("abcd") -> 4Counts elements in a given argument. If element is not countable, it is returned unmodified.
generateID()Generates unique ID

Localization function

Localize() function tries to localize an argument. Now it works only for dates and times, but it is meant to support numbers and currencies.

It is good idea to store UTC times in the database and show localized time to the user. To show localized current time in Warsaw, Poland use localize() function as following:

localize(now(),'Europe/Warsaw')

Paths

Paths uses dot notation:

$.attributeName[selector].attributeName2

where $ is root element, . selects all direct child elements from node, attributeName restricts these elements to those containing attribute of name attributeName and [] contains selector expression which restrict results even more. attributeName2 selects child elements from results of previous computation.

Complete syntax

Following table contains complete syntax of paths (near identical to the JSONPath table):

OperatorDescription
$the root object/element
@the current object/element
.child/property operator
..recursive descent. ObjectPath borrows this syntax from E4X (and JSONPath).
*wildcard. All objects/elements regardless their names.
[]selector operator. Full documentation is available in next chapter.
[start:end:step]NOT IMPLEMENTED YET array slice operator borrowed from ES4.

Selectors

Selector selects array elements that satisfy expression. You can be creative here and nest paths, use comparison operators or refer to other parts of the data set.

Selectors are written inside the [] operator.

Selectors can take number and behave as simple “give me n-th element from array”:

>>> $.*[1]
# second element from array

It also can take a string, its behavior is then similar to dot operator:

>>> $..*['string'] is $..string
true

Selector can use comparison operators to find elements:

$..*[@.attribute is 'ok']

and boolean operators to handle more than one condition:

$..*[@.attribute is 'ok' or len(@.*[1]) is 2]

@ operator matches current element. Selector iterates over left expression result (which is array). @ will match the element currently checked against expression.

WARNING! @ operator is slow! Try using or/and operators in conjunction with simple expression that should match some elements or other optimization techniques.

Plans to extend ObjectPath

Most important enhancements:

  • provide date and time manipulation built-in functions,
  • distinguish regex functions and string functions – regexes are slow and not necessary in most cases,
  • add regex matching to selectors,

Optimization plans

  • make $..*[1] faster – generator will help,
  • replace operator names with numbers.
]]>
https://objectpath.org/reference/feed/ 0